Define Primary key in table creation command : Primary key « Constraints « SQL Server / T-SQL






Define Primary key in table creation command


20>
21> CREATE TABLE employee (emp_no     INTEGER  NOT NULL,
22>                        emp_fname  CHAR(20) NOT NULL,
23>                        emp_lname  CHAR(20) NOT NULL,
24>                        dept_no    CHAR(4)  NULL,
25>                        CONSTRAINT prim_empl PRIMARY KEY (emp_no))
26> GO
1>
2> drop table employee
3> GO
1>
2> -- 
3>
           
       








Related examples in the same category

1.Combine two columns as the primary key
2.Specification of the primary key of the employee table as a column-level constraint