Prepare for the 241 Computer Science Certification Exam with comprehensive flashcards and multiple choice questions. Enhance knowledge with explanations and hints to excel in your test journey!

Multiple Choice

In a relational model, what constraint does a foreign key enforce?

Foreign keys enforce referential integrity between tables by ensuring that the value in the foreign key column matches an existing value in the referenced table’s primary key (or another unique key). This keeps related data consistent: for example, every order must reference a customer that actually exists. If a foreign key column allows NULLs, a NULL means “no reference” for that row; if it’s defined as NOT NULL, every row must reference a valid row in the other table. Actions like cascade or restrict determine what happens to dependent rows when the referenced row is updated or deleted. This constraint is about cross-table consistency, not about making lookups faster, and it doesn’t by itself enforce uniqueness within the same table or require values to be non-null unless those specifics are defined.

Foreign keys enforce referential integrity between tables by ensuring that the value in the foreign key column matches an existing value in the referenced table’s primary key (or another unique key). This keeps related data consistent: for example, every order must reference a customer that actually exists. If a foreign key column allows NULLs, a NULL means “no reference” for that row; if it’s defined as NOT NULL, every row must reference a valid row in the other table. Actions like cascade or restrict determine what happens to dependent rows when the referenced row is updated or deleted. This constraint is about cross-table consistency, not about making lookups faster, and it doesn’t by itself enforce uniqueness within the same table or require values to be non-null unless those specifics are defined.