Quiz – Relational Database Model
Table: Sales
Transaction_ Item Price Qty Total Date
ID
3006 P245 35 4 140 2025-09-08
3007 T177 45 3 135 2025-09-08
3009 T172 70 3 210 2025-09-08
3010 P238 60 5 300 2025-09-08
3011 C337 25 2 50 2025-09-08
3013 T202 105 7 735 2025-09-09
Table: Products
Product_ID Description Price
C337 Ballpen_Black 25
C338 Ballpen_Red 27
P238 Illustration_Board 60
P245 Cartolina_Large 45
T172 Glue 70
T177 Scissors 45
T202 Stapler 105
Answers
1. What is the primary key of the Sales table? (3 points)
Answer: Transaction_ID
2. What is the primary key of the Products table? (3 points)
Answer: Product_ID
3. How many foreign keys are there in the Sales table, and identify them. (10 points)
Answer: There is 1 foreign key.
- Item in Sales → references Product_ID in Products.
4. Determine if the following scenarios will trigger an error or not (2 points each).
a. A new record with the Transaction_ID 3013 is created in the Sales table.
Answer: Error – duplicate primary key.
b. A new record with the Transaction_ID 3014 is created in the Sales table with the Item
being “T202” and Qty 7.
Answer: No error – valid new record.
c. A new record with Item C337 is created in the Sales table with the Price being 38.
Answer: No error – foreign key valid, but price inconsistent.
d. A new record with the Item C339 is created in the Sales table.
Answer: Error – C339 does not exist in Products.
e. The record with the Product_ID C338 is deleted from the Products table.
Answer: No error – no Sales record references C338.
f. The record with the Transaction_ID 3011 is deleted from the Sales table.
Answer: No error – deleting a Sales record is allowed.
g. The record with the Product_ID T172 is deleted from the Products table.
Answer: Error – T172 is referenced in Sales (Transaction 3009).
Total: 30 points