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

Recommended Answers

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.

Jump to Post

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

Possible superkeys are:

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

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

read more [URL="http://wiki.answers.com/Q/What_are_the_difference_between_superkey_and_candidate_key"]here[/URL].

Jump to Post

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 …

Jump to Post

All 6 Replies

Re: What is a superkey and composite question 80 80

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 .

commented: Aye :) +14
Re: What is a superkey and composite question 80 80

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
thanks

Re: What is a superkey and composite question 80 80

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

Possible superkeys are:

{employee_id}
{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.

Re: What is a superkey and composite question 80 80

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?

Re: What is a superkey and composite question 80 80

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.

Re: What is a superkey and composite question 80 80

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?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.