Skip to content

CS Professional · Artificial Intelligence, Data Analytics and Cyber Security - Laws and Practice · Information Systems

An 'Orders' table in a Pune firm's database has a column 'CustomerID' whose values must match existing values in the 'Customers' table's primary key. Which constraint enforces this rule and prevents orders for non-existent customers?

Referential integrity enforced through a foreign key does this. It requires every CustomerID in the Orders table to match an existing primary key value in the Customers table, preventing orphan records. A unique constraint only blocks duplicates and does not link tables.

  1. AUnique constraint
  2. BReferential integrity through a foreign keyCorrect
  3. CCheck constraint on data type
  4. DDefault constraint

Explanation

A foreign key with referential integrity ensures a value in the child table must exist in the parent table's primary key. A unique constraint only prevents duplicates within the column and does not link tables, so it would not stop orphan orders.

Did you get it right without looking?

One question tells you little. A timed set on Information Systems shows your real accuracy, how long you take and where you lose marks.

More Information Systems questions