📞 0339-0387701 (WhatsApp) Contact

« Back to Database & Data Handling (NCCIA)

Which SQL clause defines a foreign key when creating a table?

A. PRIMARY KEY (CustomerID)
B. UNIQUE (CustomerID)
C. FOREIGN KEY (CustomerID) REFERENCES Customer(CustomerID) ✅
D. CHECK (CustomerID > 0)

Correct Answer: C. FOREIGN KEY (CustomerID) REFERENCES Customer(CustomerID)

Explanation

The FOREIGN KEY clause names the local column and the referenced table and column, and the DBMS then enforces the link.