Super Key in DBMS
We can define a super key as a set of those keys that identify a row or a tuple uniquely. The word super denotes the superiority of a key. Thus, a super key is the superset of a key known as a Candidate key (discussed in the next section). It means a candidate key is obtained from a super key only.
Here, we will discuss about the super key, i.e., what is the role of a super key, how to use it, and will be looking at some practical examples that will help us to understand it in a better way.
Role of Super Key
The role of the super key is simply to identify the tuples of the specified table in the database. It is the superset where the candidate key is a part of the super key only. So, all those attributes in a table that is capable of identifying the other attributes of the table in a unique manner are all super keys.
Note: Two or more attributes in a table can together identify a table uniquely, so the combination of such attributes is nothing but a super key only.
Examples of Super Key
Let's consider an EMPLOYEE_DETAIL table example where we have the following attribute:
Emp_SSN: The SSN number is stored in this field.
Emp_Id: An attribute that stores the value of the employee identification number.
Emp_name: An attribute that stores the name of the employee holding the specified employee id.
Emp_email: An attribute that stores the email id of the specified employees.
The EMPLOYEE_DETAIL table is given below that will help you understand better:
So, from the above table, we conclude the following set of the super keys:
These all are the set of super keys which, together or combining with other prime attributes, can identify a table uniquely.
Just like, if we set Super key on Emp_SSN, it will be able to identify all other tuples of the table very easily. Similarly, if we set the Super key on (Emp_Id, Emp_name}, we can easily get the value or details of the other remaining attributes of the employee. So, in this way, we can create and search out the super keys from a table.
Now, the question is how to identify the Primary key from a super key because the super key is the superset. So, the answer is that a Primary key is picked up from the super key set only by selecting a single attribute that can provide a unique identification to the whole table. Hence, it is the responsibility of the DBA to choose the most appropriate and suitable primary key out of the candidate keys or super key.
We will discuss the candidate key in the next section.