Specification of the primary key of the employee table as a column-level constraint : Primary key « Constraints « SQL Server / T-SQL






Specification of the primary key of the employee table as a column-level constraint

1> -- Specification of the primary key of the employee table as a column-level constraint.
2> CREATE TABLE employee
3>             (emp_no    INTEGER NOT NULL CONSTRAINT prim_empl PRIMARY KEY,
4>              emp_fname CHAR(20) NOT NULL,
5>              emp_lname CHAR(20) NOT NULL,
6>              dept_no   CHAR(4) NULL)
7> GO
1> drop table employee
2> GO
1>

           
       








Related examples in the same category

1.Combine two columns as the primary key
2.Define Primary key in table creation command