May 14, 2007 at 12:38 am
Hi All,
If I ran the following statement what type of primary key would it create and can this be altered in the settings?
CREATE TABLE EMP_DETAILS (EMPLOYEE_ID INT PRIMARY KEY, EMPLOYEE_NAME VARCHAR(25),
DOJ DATETIME, DEPT_ID INT, SALARY INT);
Thanks.
May 14, 2007 at 2:47 am
May 15, 2007 at 1:12 am
It will create a unique clustered non-null index. A primary key must be non-null and must be unique, however, you can add the keyword nonclustered if you don't want it clustered. Like so:
CREATE TABLE EMP_DETAILS (EMPLOYEE_ID INT nonclustered PRIMARY KEY, EMPLOYEE_NAME VARCHAR(25),
DOJ DATETIME, DEPT_ID INT, SALARY INT);
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply