954,597 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

What is a superkey and composite question

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

silvercats
Posting Whiz in Training
236 posts since Apr 2011
Reputation Points: 9
Solved Threads: 1
 

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 .

debasisdas
Posting Genius
6,872 posts since Feb 2007
Reputation Points: 666
Solved Threads: 434
 

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

silvercats
Posting Whiz in Training
236 posts since Apr 2011
Reputation Points: 9
Solved Threads: 1
 

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 .

debasisdas
Posting Genius
6,872 posts since Feb 2007
Reputation Points: 666
Solved Threads: 434
 

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

emp ID    firstname  
 12          harry
 13          harry


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

silvercats
Posting Whiz in Training
236 posts since Apr 2011
Reputation Points: 9
Solved Threads: 1
 

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.

debasisdas
Posting Genius
6,872 posts since Feb 2007
Reputation Points: 666
Solved Threads: 434
 

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?

silvercats
Posting Whiz in Training
236 posts since Apr 2011
Reputation Points: 9
Solved Threads: 1
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You