Photo AI
Question 7
A compound key is an example of a primary key. Describe what is meant by a compound key in a relational database.
Step 1
Answer
A compound key in a relational database refers to a key that consists of two or more attributes (or columns) that together uniquely identify a record in a table. These attributes can be either foreign keys from other tables or primary keys from the same table.
For example, consider a table that stores information about student enrollments. A compound key could be made up of StudentID
and CourseID
. Here, neither StudentID
nor CourseID
alone may uniquely identify an enrollment, but when combined, they create a unique identifier for each record.
This ensures that each combination of student and course is distinct, allowing for efficient data retrieval and maintaining data integrity.
Report Improved Results
Recommend to friends
Students Supported
Questions answered