order_sheet holds the order lines of a shop in one table. Its key is (order_id, product_id). Its FDs:
text
order_id → order_date, customer_id
customer_id → customer_name, customer_city
product_id → product_name, unit_price
(order_id, product_id) → quantityorder_id → … and product_id → … are partial dependencies (2NF). customer_id → … is transitive (3NF). Decompose the table so that every determinant is a key.
- How many tables does the BCNF design have?
- Create
customer(customer_id, customer_name, customer_city). - Create
product(product_id, product_name, unit_price). - Create
orders(order_id, order_date, customer_id)with a foreign key tocustomer. - Create
order_line(order_id, product_id, quantity)with foreign keys toordersandproduct. - Join the four tables and return the nine columns of
order_sheet, in its order. The result must have the same rows asorder_sheet.
Keep order_sheet: the last check compares your tables with it.