What is the difference between primary and super key?

Database keys
What exactly is the difference between primary and super key if both are considered to be unique? Why do we need super key when there is primary key?

Answer Wiki

Thanks. We'll let you know when a new response is added.

between primary and super key

Primary Key: is
the columns you choose to maintain uniqueness in a table. Here in Employee
table you can choose    either EmployeeID or SSN columns, EmployeeID is
preferable choice, as SSN is a secure value.

Super Key: If
you add any other column/attribute to a Primary Key then it become a super key,
like EmployeeID + FullName
 is a Super Key.

Check this useful article to know more details    



Discuss This Question: 5  Replies

There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • Subhendu Sen
    Assuming this is based on home work related to networking course, so if you read the study books, you can find answers easily.
    138,820 pointsBadges:
  • carlosdl
    Subhendu: The topic is not related to networking, but to database design.
    84,745 pointsBadges:
  • carlosdl
    I was asked a similar question a couple of weeks ago, but about candidate keys vs super keys.  It is relevant because a primary key is basically a candidate key.

    This is the answer I gave:


    The main difference between superkey and candidate key is that a super key can have many attributes or columns, even if not all of them are necessary to identify a row.

    For example, in an accounts table, for a bank: You could have a superkey that includes the account number and the name of the customer.

    That combination of fields identifies a row uniquely, but the name is not really necessary.

    Even if you don't include the name, only with the account number you can identify uniquely the same row.

    So, a candidate key is a key that includes only the necessary columns to uniquely identify a row.

    A candidate key doesn't include unnecessary columns.

    In this example account number is a candidate key, but the combination of account number and name would be a super key.

    84,745 pointsBadges:
  • carlosdl
    And to answer the final question: You don't really need super keys. You just need to know what they are (because database courses cover them).
    84,745 pointsBadges:
  • Aishwarya17

    It was of great help.


    20 pointsBadges:

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.


Share this item with your network: