How to Create PRIMARY KEY Constraints in SQL

In this article I am going to explain about PRIMARY KEY Constraints in SQL.
  • 2505


Primary Key enforces uniqueness of the column on which they are defined. Table is the combination of column and column contain data. There are many situations when we need to access a specific row from a tables. Primary key is used to access this specific row.

Columns that contain values that uniquely identify each row in the table is known as primary key of table. PRIMARY KEY Constraint is used to make primary key at the time of table creation or modification. It contain unique values in every rows. An other feature of primary key is that it can not accept NULL Value.

Properties of primary key constraint

  • Every value must be unique in every row.
  • It does not allow NULL value.

Statement that create primary key

create table empinfo


id int primary key,

name varchar(15),

age int,

city varchar(15),

salary money


© 2020 DotNetHeaven. All rights reserved.