mediumMultiple ChoiceObjective-mapped
FC0-U71 Practice Question: Refer to the exhibit
Exhibit
CREATE TABLE Orders (
OrderID INT PRIMARY KEY,
CustomerID INT,
OrderDate DATE,
FOREIGN KEY (CustomerID) REFERENCES Customers(CustomerID)
);Refer to the exhibit. A user attempts to insert a row into Orders with a CustomerID that does not exist in the Customers table. What is the expected outcome?
⚠ Common exam trap
It's easy for candidates to assume the database will silently accept the row or create a placeholder customer, failing to recognize that foreign key constraints enforce strict referential integrity and cause the statement to fail with an error.
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
✓
The INSERT statement fails with a constraint violation
The INSERT statement fails with a constraint violation because the CustomerID column in the Orders table is defined as a foreign key referencing the CustomerID primary key in the Customers table. When a user attempts to insert a row with a CustomerID that does not exist in the Customers table, the relational database management system (RDBMS) enforces referential integrity and rejects the operation, raising a foreign key constraint violation error.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
The row is inserted but with a warning
Why it's wrong here
The insert fails entirely.
- ✗
The row is inserted successfully
Why it's wrong here
Violates foreign key constraint.
- ✗
The Customers table automatically creates a new customer
Why it's wrong here
No cascading inserts by default.
- ✓
The INSERT statement fails with a constraint violation
Why this is correct
Foreign key constraint error.
Go deeper
Related to this question
About these practice questions
Courseiva writes every FC0-U71 question from scratch — 988 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
Same concept, more angles
3 more ways this is tested on FC0-U71
These questions test the same concept from different angles. Work through them to make sure you can recognise it however the exam phrases it.
Variation 1. 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?
medium- A.Check constraint on CustomerID
- B.Primary key on CustomerID
- ✓ C.Foreign key on CustomerID referencing Customers
- D.Unique constraint on CustomerID
Why C: 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.
Variation 2. A sales database has a Customers table with CustomerID as the primary key and an Orders table that includes CustomerID. Which type of relationship is typically established between Customers and Orders?
medium- A.One-to-one
- B.Many-to-many
- C.Unrelated
- ✓ D.One-to-many
Why D: A customer can have multiple orders, but each order belongs to one customer, so it's a one-to-many relationship.
Variation 3. A database has a table 'Orders' with columns OrderID (primary key), CustomerID, OrderDate, and TotalAmount. Which SQL statement will delete all orders placed before January 1, 2023?
hard- A.DROP FROM Orders WHERE OrderDate < '2023-01-01'
- ✓ B.DELETE FROM Orders WHERE OrderDate < '2023-01-01'
- C.DELETE OrderDate < '2023-01-01' FROM Orders
- D.REMOVE FROM Orders WHERE OrderDate < '2023-01-01'
Why B: DELETE FROM table WHERE condition removes rows that satisfy the condition.
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.