Superkey definition
Superkey refers to a combination of columns that uniquely identify rows within an RDBMS (relational database management system) table. Superkeys contain several attributes that may not work independently. Combining these attributes together creates a superkey that forces every row to be unique. Superkeys are used in database design to help identify and retrieve data.
How superkeys work
A table can contain a set of columns you may want to combine and look up, for example:
- Employee name.
- Employee ID.
- Address.
- Phone number.
- Email.
To help uniquely identify any row, we can create a superkey using all or some of these attributes. For example:
- Employee name+Employee ID+Address+Phone number+Email
- Employee name+Address+Phone number
- Employee name+Employee ID+Email
- Address+Phone number+Email
This process can be reduced by assuming that one attribute is unique (e.g., Employee ID). The superkey then becomes a single attribute (also known as candidate key).
However, using a single key does not necessarily ensure complete uniqueness. Therefore, superkeys — or combinations of several attributes — provide a better method of uniquely identifying rows.
Where superkeys may be used
- Employee record management
- Customer databases
- Mailing list database
See also: database concurrency