Question 2
Consider the following six relations for an order-processing database applicationin a company:
CUSTOMER (Cust#, Cname, City)
ORDER (Order#, Odate, Cust#, Ord_Amt)
ORDER_ITEM (Order#, Item#, Qty)
ITEM (Item#, Unit_price)
SHIPMENT (Order#, Warehouse#, Ship_date)
WAREHOUSE (Warehouse#, City)
Specify the foreign keys for this schema, stating any assumptions you make.
Foreign Keys: Those attributes in a relation are known as foreign Keys that are the primary keys of another table.
1.
FOREIGN KEY ORDER(Cust#) REFERENCES CUSTOMER(Cust#)
i.e., Cust# attribute in table 'ORDER' is a foreign key that references table 'CUSTOMER'
2.
FOREIGN KEY ORDER_ITEM(Order#) REFERENCES ORDER(Order#)
3.
FOREIGN KEY ORDER_ITEM(Item#) REFERENCES ITEM(Item#)
4.
FOREIGN KEY SHIPMENT(Order#) REFERENCES ORDER(Order#)
5.
FOREIGN KEY SHIPMENT(Warehouse#) REFERENCES WAREHOUSE (Warehouse#)
Get Answers For Free
Most questions answered within 1 hours.