MySQL | SUPER Key: Learn about the MySQL SUPER Key, with its explanation, syntax, and query examples.
Submitted by Apurva Mathur, on September 15, 2022


When a group of attributes/columns distinctly identify the records those attributes are known as the super key.

The super key concept is theoretical but it is really important for competitive purposes.

Let us understand this concept through an example;

Suppose we have a table named "student_details" and inside this table, we have the following columns,

  • Student_ID
  • Student_Name
  • Roll_Number
  • DOB
  • Email
  • Address
  • Branch

Now, suppose if I only take any "Student_Name", will that be unique? No, of course, because we may have many students of the same name, now if I only consider "DOB" (date of birth) will that alone be considered as unique records? Nor this can be considered a unique record as many students have a common date of birth, but what if I take a combination of "Student_Name", "DOB", and "Roll_Number", now the records which will come inside these attributes will be unique? Obviously because now the roll number column is added and with the help of this we can easily get the distinct record.

A table may have single or pair of attributes as the super key.

According to the above table we can have the following super keys,

  • Student_ID: The student's IDs attribute is unique itself so it is also considered a super key.
  • Roll_Number: The roll numbers of every student are unique so this will be also considered a super key.
  • Email: Emails are always unique; in this entire world no one can have the same emails.
  • Student_ID + Student_Name: This combination will always give unique records.
  • Student_ID + Student_Name + Roll_Number: This combination will be also unique so the set of these attributes will be considered a super key.

We can make many super keys in one table, the only condition it should follow is that, it should be unique, doesn't matter if it is a single attribute or group of attributes, but it should give distinct records.


Comments and Discussions!

Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© some rights reserved.