📞 0339-0387701 (WhatsApp) Contact

« Back to Database & Data Handling (NCCIA)

Which of the following is a correct foreign-key implementation scenario?

A. Customer.CustomerID references Order.OrderID
B. Order.CustomerID references Customer.CustomerID, so an order cannot be created for a non-existent customer ✅
C. Order.CustomerID is the primary key of Customer
D. Order.CustomerID references Order.OrderID

Correct Answer: B. Order.CustomerID references Customer.CustomerID, so an order cannot be created for a non-existent customer

Explanation

A foreign key must reference the primary key of the parent table, and it blocks inserts that point to a missing parent.