Give a suitable example of a table with sample data and illustrate Primary and Candidate keys in it.

7 views

1 Answers

A table may have more than one such attribute or a group of an attribute that identifies a row/ tuple uniquely, all such attribute(s) are known as Candidate keys. Out of the Candidate keys, one is selected as Primary key.

Table: Stock

ID Item Qty
101 Pen 560
102 Pencil 780
104 CD 450
109 Floopy 700
105 Eraser 300
103 Duster 200

Id = Primary key Id and Qty = Candidates Keys

7 views