Which statement describes a composite primary key?

Get ready for the GMetrix Data Modeling Test. Enhance your skills with flashcards and multiple choice questions, complete with hints and explanations. Prepare effectively for success!

Multiple Choice

Which statement describes a composite primary key?

Explanation:
A composite primary key is a primary key built from two or more columns, and the row is considered unique only by the combination of those values. This works when no single attribute uniquely identifies a row, but the pair (or triple) does. For example, in a course enrollment table, the combination of student_id and course_id uniquely identifies each enrollment: a student may take many courses, and each course has many students, but the same student in the same course should appear only once. Remember that primary keys must be not null, so every part of a composite key must have a value. The idea that it’s just one column describes a simple primary key, not a composite one, and saying all parts must be null contradicts the not-null rule. Composite keys are common in join tables and in situations where uniqueness arises only from a combination of columns.

A composite primary key is a primary key built from two or more columns, and the row is considered unique only by the combination of those values. This works when no single attribute uniquely identifies a row, but the pair (or triple) does. For example, in a course enrollment table, the combination of student_id and course_id uniquely identifies each enrollment: a student may take many courses, and each course has many students, but the same student in the same course should appear only once. Remember that primary keys must be not null, so every part of a composite key must have a value. The idea that it’s just one column describes a simple primary key, not a composite one, and saying all parts must be null contradicts the not-null rule. Composite keys are common in join tables and in situations where uniqueness arises only from a combination of columns.

Subscribe

Get the latest from Passetra

You can unsubscribe at any time. Read our privacy policy