-2

Consider a relational table with different columns, what would you call the collection of unique and not null values, super key or candidate key?

Dharman
  • 30,962
  • 25
  • 85
  • 135
  • Well, what are the definitions of the terms? What did googling your question give? – philipxy Aug 04 '17 at 12:36
  • Possible duplicate of [Superkey, candidate key & primary key](https://stackoverflow.com/questions/8337309/superkey-candidate-key-primary-key) – philipxy Aug 04 '17 at 13:01
  • Does this answer your question? [Does an empty SQL table have a superkey? Does every SQL table have one?](https://stackoverflow.com/questions/46024902/does-an-empty-sql-table-have-a-superkey-does-every-sql-table-have-one) – philipxy Mar 16 '22 at 00:07

1 Answers1

1

A Super key is a set or one of more columns to uniquely identify rows in a table.

Candidate keys are selected from the set of super keys, the only thing we take care while selecting candidate key is: It should not have any redundant attribute. That’s the reason they are also termed as minimal super key.

In Employee table there are Three Columns : Emp_Code,Emp_Number,Emp_Name

Super keys:

All of the following sets are able to uniquely identify rows of the employee table.

{Emp_Code}
{Emp_Number}
{Emp_Code, Emp_Number}
{Emp_Code, Emp_Name}
{Emp_Code, Emp_Number, Emp_Name}
{Emp_Number, Emp_Name}

Candidate Keys:

As I stated above, they are the minimal super keys with no redundant attributes.

{Emp_Code}
{Emp_Number}

As a Summary:

A Superkey is a set of columns that uniquely identifies a row.Whereas a Candidate key would be a MINIMAL set of columns that uniquely identifies a row. So essentially a Superkey is a Candidate key with extra unnecessary columns in it.

philipxy
  • 14,867
  • 6
  • 39
  • 83
Ahmad
  • 445
  • 5
  • 15