Super Key in DBMS
Super Key in DBMS: The super key is a column or a set of columns in the database table, which uniquely identifies the tuple or row of the same table. It is a type of key, which is the superset of the candidate key.
We are describing this concept with the following example.
This example uses an Employee table, which contains three columns/fields/attributes. The names of these three columns in the table are Employee_ID, Employee_Name, Employee_EmailID.
Employee_ID | Employee_Name | Employee_EmailID |
301 | Anuj | [email protected] |
302 | Chetan | [email protected] |
303 | Lalit | [email protected] |
304 | Lakshman | [email protected] |
305 | Lalit | [email protected] |
Table: Employee
Now, we have to search for all the super keys present in the above table.
Following are the super keys of this employee table:
1. { Employee_ID}
2. {Employee_EmailID}
3. { Employee_ID, Employee_EmailID }
4. { Employee_ID, Employee_Name }
5. { Employee_ID, Employee_Name, Employee_EmailID }
6. { Employee_Name, Employee_EmailID }
All the above columns or sets of columns are able to uniquely identify each row in the table Employee. So, each defined key is a super key. You can easily identify the candidate keys from the above-defined keys.
Now, we will learn about the difference between the candidate and super key.
Difference Between the Super key and Candidate Key
Super Key | Candidate key |
1. It is a field or set of fields/columns, which uniquely denotes each record in the database table. | 1. It is a proper subset of the super key. |
2. The number of keys defined as super is more than the number of candidate keys in any database table. | 2. In the same database table, the number of keys defined as a candidate is less than the number of super keys. |
3. All the keys which are defined as the super key cannot be candidate keys. | 3. But, all the table keys defined as the candidate key are the super keys. |