Which of the following should be unique in a database?
(A). Candidate key
(B). Foreign key
(C). Primary key
(D). Composite key
Which of the following should be unique in a database?
(A). Candidate key
(B). Foreign key
(C). Primary key
(D). Composite key
Solution
A candidate key is a minimal set of attributes that uniquely identifies every row. The primary key is the candidate key chosen to identify rows, so it must be unique and non-null. A composite key is a key made of two or more attributes whose combination uniquely identifies a row. Each column alone may repeat, but the combination cannot.
Foreign key (Options 2 and 3): it only refers to a key in another table, so its values can repeat (many orders can belong to one customer) and can be null.
Option 1: it leaves out the composite key, which is also unique as a combination of attributes.
Related questions:
2026: 24 May Shift 1
Calculate the degree and cardinality of the given relation below:
| ID | Name | Address | Phone No. | |
|---|---|---|---|---|
| 001 | Ajay | [email protected] | A1-Shakti Nagar, Bangalore | 55218936 |
| 002 | Amit | [email protected] | C32- Indira Nagar, Lucknow | 45321789 |
| 003 | Ashu | [email protected] | 117/82 Patel Nagar, Delhi | 98567894 |
| 004 | Ashok | [email protected] | 249-250, Motinagar, Gujrat | 97698541 |
2025: 22 May Shift 1