1.

Define Primary And Unique Key?

Answer»

Primary Key

  • The COLUMN or columns of the table whose value uniquely IDENTIFIES each row in the table is called primary key.
  • You can define column as primary key using primary key constraint while you create table.
  • When you define a column as primary key, a unique INDEX is created which restricts duplicate data and FAST access to data.
  • A column defined as primary key doesn't allow null value.
  • By default, clustered index in created with the column having primary key.

Unique key

  • Unique key also ensures data uniqueness like primary key.
  • A column with unique key defined ALLOWS null value. 
  • By default, it creates non-clustered index.

Primary Key

Unique key



Discussion

No Comment Found