Can we define multiple Unique Keys in a table ?

 Posted by Akiii on 6/1/2012 | Category: Sql Server Interview questions | Views: 1756 | Points: 40
Answer:

Yes, we can define multiple unique keys in a table.

Create Table Sampletable

(
UserID integer NOT NULL PRIMARY KEY,
UserName varchar(50),
FirstName varchar(50) ,
LastName varchar(50),
CONSTRAINT us_UserId UNIQUE (UserID),
CONSTRAINT us_Username UNIQUE (UserName)
)


| Alert Moderator 

Comments or Responses

Login to post response