Practice mode DBMS and SQL

In table OrderItem(order_id, product_id, quantity), neither order_id nor product_id is unique alone, so the primary key is declared as (order_id, product_id). What is such a key called?

Correct answer B. Composite key

Explanation

A composite (compound) key is made of two or more attributes that together identify a row, even though no single one does. Here an order contains many products and a product appears in many orders, but each (order, product) pair appears once. A surrogate key would be an artificial single column such as item_id. Each part may also be a foreign key, but the combined key is composite.

Report a problem

Answer checked How we write and check questions

Tip: press A, B, C or D to answer, and N for the next question.

Advertisement

Have a question about this answer?

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

Links and website addresses are not allowed in comments.