Professional Documents
Culture Documents
ITE3712 MockTest Paper Ans
ITE3712 MockTest Paper Ans
A1.
a. Match each key term with its definition by placing the letter of the definition in
the space provided. (Total: 8 marks)
(2 marks each)
Key Terms Answers Definitions
2. Relationship
A relationship shows how two entities share information in the
database.
3. Validation
rule Rules that a user must follow when entering data to ensure
valid data.
A2.
Given the following two tables: (Total: 20 marks)
PRODUCT table
PID Description Cost OrderDate Stock SID
P001 Cheese Sandwich $15.2 16-Jan-2022 37 S03
P002 Seafood Salad $32.6 15-Jan-2022 52 S02
P003 Rice Burger $11.8 18-Jan-2022 90 S01
P004 Cupcake $8.0 20-Jan-2022 71 S01
SHOP table
ShopID SName PhoneNum OnlineShop
S01 Welldone 2233-4666
S02 NineEleven 3579-0001
S03 GoodLuck 9091-0123
a. Fill in the Data Type (Access 2016) for the following fields of the PRODUCT
table and the SHOP table. (4 marks)
Answer:
Field Data Type
Stock Number
OrderDate Date/Time
OnlineShop Yes/No
Cost Currency
b. Write an Input Mask for the field, PhoneNum, which has the format: dd-mmm-
yyyy. (Hint: dd, yyyy are digits, mmm are letters). (3 marks)
Answer:
00-LLL-0000
c. Write a Validation Rule for the field, Stock, so that the input value be greater
than 0 and less than or equal to 150) (2 marks)
Answer:
Page 1 of 12
d. What will be displayed if the following fields and criteria are used in a query in
the MS Access Design View? (3 marks)
Answer:
PID Description Cost Stock
P001 Cheese Sandwich $15.2 37
e. What will be displayed if the following fields and criteria are used in a query in
the MS Access Design View? (2 marks)
Answer:
PID Cost SName
P001 $15.2 GoodLuck
Page 2 of 12
f. Complete the query in the MS Access Design View below for the PRODUCT
table to display the field, PID, and add a new field called NewCost. The formula
of NewCost is given below: (4 marks)
Formula:
NewCost = Cost * 1.06
Answer:
Field: PID NewCost: [Cost]*1.06
Table: PRODUCT
Sort:
Show:
Criteria:
Or:
Page 3 of 12
g. Complete the query in the MS Access Design View below for the PRODUCT
table to display the sum Stock of the products.
(2 marks)
Answer:
Field: Stock
Table: PRODUCT
Total: SUM
Sort:
Show:
Criteria:
Or:
Page 4 of 12
A3.
ERD (Total: 20 marks)
a. Besides the Entity component, list ANY TWO main components of an Entity
Relationship Diagram (ERD).
(2 marks)
Answer: Relationship, Attribute, Connecting line, Cardinality
____________________________
____________________________
SHOP table
ShopID SName PhoneNum OnlineShop
S01 Welldone 2233-4666
S02 NineEleven 3579-0001
S03 GoodLuck 9091-0123
i. How many attributes (fields) are there in the SHOP table? (2 marks)
Answer: 4
ii. How many records are there in the PRODUCT table? (2 marks)
Answer: 4
iii. Which field should be chosen as the Primary Key for the PRODUCT table?
Give ANY TWO reasons. (4 marks)
Answer:
Primary Key: PID______________________________
Page 5 of 12
iv. Which field should be chosen as the Foreign Key for the PRODUCT table?
Give the reason. (4 marks)
Answer:
Foreign Key: SID
v. Draw an Entity Relationship Diagram (ERD) for the PRODUCT database for
the following scenarios. You are not required to show the column names in
the entities.
a. Each Product has one and more Shop. Each Shop may have zero or more
PRODUCT(s). (3 marks)
Answer:
b. Each Shop may have zero or more Order (s). Each Order must have
at least one or one Shop. (3 marks)
Answer:
Page 6 of 12
A4.
Given the following 2 tables, write/complete SQL statements below.
(Total: 20 marks)
PRODUCT table
PID Description Cost OrderDate Stock SID
P001 Cheese Sandwich $15.2 16-Jan-2022 37 S03
P002 Seafood Salad $32.6 15-Jan-2022 52 S02
P003 Rice Burger $11.8 18-Jan-2022 90 S01
P004 Cupcake $8.0 20-Jan-2022 71 S01
SHOP table
ShopID SName PhoneNum OnlineShop
S01 Welldone 2233-4666
S02 NineEleven 3579-0001
S03 GoodLuck 9091-0123
Answer:
SELECT *
FROM PRODUCT;
b. Complete the following SQL statement to display ShopID and SName with no
OnlineShop in the SHOP table. (2 marks)
Answer:
FROM SHOP
Page 7 of 12
c. Given the SELECT query in the MS Access Design View below: (3 marks)
Field: PID Description Cost
Table: PRODUCT PRODUCT PRODUCT
Sort:
Show:
Criteria: Like "*oo*"
Or:
Answer:
FROM PRODUCT
d. Complete the following SQL statement to display all the records in the
PRODUCT table with the value of SID not equal to "S02" or OrderDate after
15-Jan-2022, in descending order of PID. (4 marks)
Answer:
SELECT *
FROM PRODUCT
Page 8 of 12
e. Complete the following SQL statement to INSERT the following record into the
PRODUCT table. (3 marks)
Answer:
f. Complete the following SQL statement to UPDATE the value of SID to "S01"
for PID equal to "P005" in the PRODUCT table as shown below: (3 marks)
PID Description Cost OrderDate Stock SID
P005 Croissant $16.0 17-Jan-2022 101 S02 S01
Answer:
UPDATE PRODUCT
g. Complete the following SQL statement to DELETE the record with the value of
PID equal to "P005" from the PRODUCT table as shown below: (2 marks)
PID Description Cost OrderDate Stock SID
P005 Croissant $16.0 17-Jan-2022 101 S01
Answer:
- End of Section A -
Page 9 of 12