• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

Super Keys in Databases

Ranch Hand
Posts: 385
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have understand about Super Key, in layman language is that super key is ONE UNIQUE KEY AND ONE NON UNIQUE KEY

which means

> Primary Key is unique + Non Unique Key = Super Key
> Composite Key is Unique + Non Unique Key = Super Key
> Candidate Key is unique + Non Unique Key = SUper Key

Is this assumption correct?

NOTE for Mods: As i have to define Super Keys in my project, I am not getting appropriate Topic under which i can post this but i read in JDBC it's written "could even brush on some SQL", as it is related to that aspect, so i posted here. If it is not correct, please relocate it, so that i can find appropriate topic under which it should be posted. Thank you
Posts: 2407
Scala Python Oracle Postgres Database Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, I've been a database application developer for over 20 years, and until today I don't recall ever hearing of "super keys", so I guess you learn something new every day, eh? Also, your reference to a "non unique key" doesn't make sense : a key is either unique or it is not a key (or it is a foreign key pointing to a unique key in another table).

From a quick search around the net, the general opinion seems to be that a "super key" is any combination of attributes that might uniquely identify a record, but a "candidate key" is a "superkey" where you cannot remove any attributes without breaking the uniqueness e.g. see the comments on this Stack Overflow post. So the candidate key is described as a minimal (or "irreducible") super key. Looked at another way, all candidate/primary keys are "super keys", but not all super keys are candidate/primary keys.

But I cannot think of any situation in my 20+ years as a DB developer where it has been necessary to know or care about "super keys" because they are of no practical use when modelling data on a relational database platform: you need to know the candidate keys, so you can identify one or more useful unique (business) keys, and you might want to use one of these as your primary key, or add a surrogate key as your primary key (very useful). I suppose there might be business rules requiring you to enforce uniqueness across non-candidate "super keys", but I don't recall ever having to implement this. So I don't really see any use for "super keys" except as an academic abstraction.

But maybe some smarter head than mine can enlighten us both!
Azrael Noor
Ranch Hand
Posts: 385
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for your reply Chris

What i understand in layman language is:

> Super Key is part of data modelling, that is any combination of attributes that might uniquely identify a record (May includes Primary Keys(Composite Keys), Candidate keys)
> Candidate Key is itself a Super Key where Uniqueness is important which is not important in Super Keys (not sure, it must be)..

As per Example in your link,

Means here any keys i use to select particular column is collective called Super Key,

As you said, it is merely a term and not used in practical,

like i am using Address and phone number to pick some detail (in poorly modeled db, it should have a primary table, but i am not going to touch it),

now using these two columns means that,
> i am using Composite Key,
> i am using Super Key and
> i am using Candidate key?

is it correct??
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!