HiveBrain v1.2.0
Get Started
← Back to all entries
gotchaMajor

What is the difference between a primary key and a superkey in a DBMS

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
theprimarywhatsuperkeydifferencebetweendbmsandkey

Problem

-
What is the difference between a primary key and a superkey in a DBMS?

-
Can a primary key and a superkey both have multiple columns?

-
Is a primary key a subset of a superkey or vice versa?

Solution

A Super Key is simply a non-minimal Candidate Key, that is to say one with additional columns not strictly required to ensure uniqueness of the row.

A Primary Key is a minimal Candidate Key, which is to say all constituent columns are strictly required in order to ensure uniqueness.

As a database developer/designer of 30 years experience, I had never even heard the term Super Key until I saw this question, and looked it up. The concept of Super Key seems more germane to the topic of performance and Physical Schema design as it directly maps to the concept of a unique nonclustered index with additional columns for improved query covering.

Context

StackExchange Database Administrators Q#71924, answer score: 24

Revisions (0)

No revisions yet.