A super key is a collection of all keys that can uniquely identify rows of a table. It is a superset of all possible
In a relational
The table below shows an example of a relation.
product_no | product_name | product_type |
6000yt | splizer300 | washer machine |
3425r | junes34 | standing fan |
4530h | junes34 | toaster |
3545k | hydrator | washer machine |
4578j | splizer300 | washer machine |
Using the products
relation above, we can perform the steps below to get the super keys of the relation.
List all sets of possible attributes combinations from the table, as shown below:
{product_no}
{product_name}
{product_type}
{product_no,product_name}
{product_no,product_type}
{product_name,product_type}
{product_no,product_name,product_type}
Next, from the list above, remove all combinations that are not in compliance with the super key requirement. This requirement simply entails that there cannot be the same attribute value for distinct tuples.
Simply put, this step will require that you identify all candidate keys
and all composite keys
from the list you made in step 1, and eliminate the ones that do not fall under this category.
With regards to our products
relation example, the combination {product_name, product_type}
will be eliminated, because the two distinct tuples below could exist.
{6000yt,splizer300, washer machine}
{4578j,splizer300, washer machine}
Similarly, the {product name}
and {product type}
columns will be eliminated because they are not unique.
Finally, make a list of the super keys we have identified. The breakdown of the list is as follows:
{product_no}
: (A candidate key)
{product_no,product_name}
: (A composite key)
{product_no,product_type}
: (A composite key)
{product_no,product_name,product_type}
: (A composite key)
For our example, the list of super keys is shown below.
Super keys |
{product_no} |
{product_no,product_name} |
{product_no,product_type} |
{product_no,product_name,product_type} |