What is a superkey?(better,with examples).what is the difference between composite key and a superkey? composite key= compound key?

6 Years
Discussion Span
Last Post by silvercats

Superkey - A superkey is defined in the relational model as a set of attributes of a relation variable (relvar) for which it holds that in all relations assigned to that variable there are no two distinct tuples (rows) that have the same values for the attributes in this set.

please read more here, here, here .

Edited by debasisdas: n/a

Votes + Comments
Aye :)

I have read two of links you have given ,before asking this question here,but they were too confusing.......
please provide me with a simple example if possible


Given table: EMPLOYEES{employee_id, firstname, surname, sal}

Possible superkeys are:

{employee_id, firstname}
(employee_id, firstname, surname, sal}

Only the the minimal superkey - {employee_id} - will be considered as a candidate key.

read more here.

Edited by debasisdas: n/a


1.Which means ,a primary key can be considered as a superkey too?
2.if we get

[U]emp ID[/U]   [U] firstname [/U] 
 12          harry
 13          harry

What is the superkey? 12,harry or 13,harry?

Edited by silvercats: n/a


yes, it can be if it a combination of more than one field and may be one filed is enough to uniquely identify the records.

in your case super key is not (12,harry) or (13,harry)

it is (emp_ID, firstname)

and since data in firstname column is exactly same , that is not going to help in uniquely identifying the records.

So only the emp_id is enough for the unique identification of record.

Edited by debasisdas: n/a


1-If we got (12,harry) or (13,fedrick) ,we can take superkey as {emp_ID,firstname } or {emp_id} or {first name} or ALL?

2-if we have two column as the super key,it will also be a composite key,right?

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.