📞 0339-0387701 (WhatsApp) Contact

« Back to Database & Data Handling (NCCIA)

A Shop has Customers and LoyaltyCards. Each customer may have one card and each card belongs to one customer, but a card is optional. How is this mapped?

A. With a junction table
B. With a foreign key in the Customer table with no constraint
C. With a nullable unique foreign key in the LoyaltyCard table referencing Customer ✅
D. By merging the tables always

Correct Answer: C. With a nullable unique foreign key in the LoyaltyCard table referencing Customer

Explanation

The UNIQUE foreign key enforces one-to-one, while allowing null means a customer can exist without a card.