The PRIMARY KEY Clause : Primary Key « Constraints « SQL Server / T-SQL Tutorial






The PRIMARY KEY clause has the following form:

      [CONSTRAINT c_name]
      PRIMARY KEY [CLUSTERED | NONCLUSTERED] (col_name1 [{,col_name2} ...])


11>
12> CREATE TABLE employee (emp_no INTEGER NOT NULL,
13>               emp_fname CHAR(20) NOT NULL,
14>               emp_lname CHAR(20) NOT NULL,
15>               dept_no CHAR(4) NULL,
16>       CONSTRAINT prim_empl PRIMARY KEY (emp_no))
17>
18> drop table employee;
19> GO
1>








7.2.Primary Key
7.2.1.Primary Key Constraint
7.2.2.The PRIMARY KEY Clause
7.2.3.Define constraint name for primary key
7.2.4.PRIMARY KEY (cust_id)
7.2.5.You cannot add another primary key to table
7.2.6.NONCLUSTERED PRIMARY KEY
7.2.7.Using a Multicolumn Primary Key