Courseiva
mediumMultiple Choice

FC0-U71 Practice Question: A company's customer database contains a table…

A company's customer database contains a table named 'Orders' with columns: OrderID, CustomerID, ProductID, Quantity, OrderDate. The company wants to enforce that every CustomerID in 'Orders' must exist in the 'Customers' table. Which database constraint should be added to the 'Orders' table?

⚠ Common exam trap

A common mix-up: candidates confuse a foreign key with a primary key or a unique constraint, mistakenly thinking that enforcing uniqueness or a simple check is sufficient to link two tables, when only a foreign key provides cross-table referential integrity.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

✓

Foreign key on CustomerID referencing Customers

A foreign key constraint on the CustomerID column in the Orders table ensures referential integrity by requiring that every value entered in that column must match a CustomerID value in the Customers table. This prevents orphan records and maintains consistency between the two tables, which is the standard relational database approach for enforcing such a relationship.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✗

    Check constraint on CustomerID

    Why it's wrong here

    A check constraint validates values within the same row against a condition, so it cannot confirm that a CustomerID exists in another table. A foreign key on CustomerID referencing Customers enforces that referential integrity. It is tempting because check constraints do restrict column values, but they cannot reference external tables.

  • ✗

    Primary key on CustomerID

    Why it's wrong here

    A primary key enforces uniqueness and non-null values within Orders itself, which would wrongly prevent one customer placing multiple orders and still permit IDs absent from Customers. A foreign key on CustomerID referencing Customers enforces the required existence. It is tempting because primary keys also constrain a column's values.

  • ✓

    Foreign key on CustomerID referencing Customers

    Why this is correct

    A foreign key on CustomerID references the primary key in Customers, so the database rejects any Orders row whose CustomerID lacks a matching parent. This enforces the required referential integrity that every CustomerID must exist in Customers.

  • ✗

    Unique constraint on CustomerID

    Why it's wrong here

    A unique constraint enforces distinct values within Orders, permitting duplicate CustomerIDs across rows while blocking repeats — the opposite of referential integrity. It is tempting because uniqueness suits natural-key columns like email, and would be correct if Orders required one row per customer.

About these practice questions

This FC0-U71 question is part of Courseiva's 988-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This FC0-U71 practice question is part of Courseiva's free CompTIA certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the FC0-U71 exam.