SQL Key

What is a key in SQL?

Questions by sachin_ambre

Showing Answers 1 - 6 of 6 Answers

We have different types of keys in sql:
primary key
     identify record uniquely
     max one per table
     do not contain null values
     create clustered index by default
unique key
     identify record uniquely
      table can have more than one unique key
     can contain 1 null value
     create non clustered index by default
foreign key
    used to impose referential integrity
    can have null values
surrogate key
    insert a new column to identify a  record uniquely
    like adding any new column with identity column

  Was this answer useful?  Yes

Candidate Key, Alternate Key, Composite Key are also the parts of SQL Server:

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.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.