Home > Database, SQL Server, Uncategorized > What are Candidate, alternate and composite keys?

What are Candidate, alternate and composite keys?

A candidate key is one that can identify each row of a table uniquely. Generally a candidate key becomes the primary key of the table. If the table has more than one candidate key, one of them will become the primary key, and the rest are called alternate keys.

A key formed by combining at least two or more columns is called composite key.

Advertisements
  1. rajat
    November 28, 2006 at 6:07 am

    This is a good definition,I ever found.This is simple and not confusing definition.

    Thanks

  2. June 19, 2007 at 9:51 am

    Good. Please Give the example.

  3. April 14, 2008 at 12:47 pm

    This is straight definition and very understandable

  4. Himesh
    November 18, 2009 at 10:39 am

    very useful.. thank u

  5. Archana Srivastava
    March 11, 2011 at 5:25 pm

    This is the best definition. Thanks

  6. Ryan
    September 12, 2011 at 3:39 pm

    There is one big piece you missed. A candidate key does not have extra information. For example, if a table has SSN and PhoneNumber (among others) fields:

    could be a superkey because it uniquely identifies a record

    However,

    would most likely be the candidate key, as it uniquely identifies each record, without adding unnecessary information.

    The distinction is slight, but this can have a huge impact on database performance/usability, as foreign keys required a candidate key in the parent table.

    • Ryan
      September 12, 2011 at 3:40 pm

      Looks like wordpress took out some field lists i had put in lessthan/greater than.

      SSN, PhoneNumber (super key)
      SSN (candidate key)

  7. venkat
    December 22, 2011 at 8:56 am

    Very Useful……

  8. godwin dsouza
    December 22, 2012 at 5:44 am

    Very Useful Information… Easy to Understand.. Thanks a Lot..:)

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: