101k views
1 vote
Which of the following is a correct statement about foreign keys?

1) All foreign keys cannot not be blank (null).
2) Most foreign keys should not have any data values.
3) A foreign key must be another table's primary key.
4) An attribute cannot be a foreign key used in different tables.

User Jamby
by
8.7k points

1 Answer

3 votes

Final answer:

The correct statement is that a foreign key must be another table's primary key. Foreign keys identify rows in another table and can be null unless otherwise constrained. An attribute can indeed be a foreign key in multiple tables, supporting data normalization.

Step-by-step explanation:

The correct statement about foreign keys from the given options is 3) A foreign key must be another table's primary key. A foreign key is a field (or collection of fields) in one table that uniquely identifies a row of another table. The foreign key is defined in a child table but refers to the primary key in the parent table. It's important to note that while all foreign keys reference a primary key in another table, not all foreign keys need to be unique in the child's table, and they can allow null values, unless explicitly constrained otherwise.



Therefore, statement 1) is incorrect because foreign keys can be null unless the table design specifically disallows it. Statement 2) is incorrect because foreign keys typically contain data values that correspond to the primary keys they reference. Statement 4) is not valid because an attribute can be a foreign key in multiple tables; this is a common practice in database normalization where one table's primary key is referenced by several other tables.

User Michael McGowan
by
7.6k points