What is a composite key in a relational database?

What is a composite key in a relational database?

a) A key that consists of two or more columns used to uniquely identify a row
b) A key that is not unique
c) A key used to link multiple tables together
d) A key that is automatically generated by the database

Answer:

a) A key that consists of two or more columns used to uniquely identify a row

Explanation:

A composite key is a primary key that consists of two or more columns, which together uniquely identify a row in a table. Composite keys are used when no single column is sufficient to ensure uniqueness across the table.

For example, in an “orders” table, a composite key could consist of the “order_id” and “product_id” columns to uniquely identify each order for a specific product.

Composite keys are commonly used in many-to-many relationship tables where multiple columns are required to establish uniqueness.

Reference:

Database Management System MCQ (Multiple Choice Questions)

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top