hardMultiple Choice
FC0-U71 Practice Question: A university database includes a table named…
A university database includes a table named 'Students' and a table named 'Enrollments'. The 'Enrollments' table has a foreign key column 'StudentID' that references the 'StudentID' primary key in the 'Students' table. The university policy requires that when a student withdraws (i.e., their record is deleted from the 'Students' table), all of their associated enrollment records must be automatically removed to maintain data consistency. The database administrator wants to enforce this rule at the database level. Which referential action should be applied when creating the foreign key constraint on the 'Enrollments' table?
⚠ Common exam trap
Watch out — candidates often confuse ON DELETE CASCADE with ON DELETE SET NULL or ON DELETE RESTRICT, mistakenly thinking that preventing deletion or setting NULL satisfies the automatic removal requirement, when only CASCADE actually deletes the child records automatically.
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
✓
ON DELETE CASCADE
(ON DELETE CASCADE) is correct because it automatically deletes all child rows in the 'Enrollments' table when the corresponding parent row in the 'Students' table is deleted. This enforces the university policy of removing associated enrollment records upon student withdrawal, maintaining referential integrity at the database level without manual intervention.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
ON DELETE CASCADE
Why this is correct
ON DELETE CASCADE automatically deletes matching child rows in 'Enrollments' whenever the referenced parent row in 'Students' is removed, enforcing the university's withdrawal rule directly within the foreign key constraint. This satisfies the requirement for database-level enforcement, guaranteeing referential integrity without relying on application code or manual cleanup.
- ✗
ON DELETE SET NULL
Why it's wrong here
ON DELETE SET NULL writes NULL into the Enrollments.StudentID column, leaving enrollment rows present but unlinked rather than removed. It is tempting because it preserves child records for optional relationships, which is correct when enrollments should survive a student's deletion with no assigned student.
- ✗
ON DELETE NO ACTION
Why it's wrong here
ON DELETE NO ACTION raises an error on the parent delete, so enrollment rows are neither removed nor updated, contradicting the automatic-removal policy. It is tempting because it is the default behaviour in many database engines and is correct when deletions must be blocked pending manual cleanup.
- ✗
ON DELETE RESTRICT
Why it's wrong here
ON DELETE RESTRICT blocks deletion of a parent row while matching child rows exist, so withdrawing a student would fail rather than cascade. It is tempting because RESTRICT is the correct choice when policy demands preventing orphaned enrollments by prohibiting the parent delete outright.
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 →
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.