You are a database developer of a Microsoft SQL Server database. You are designing a table that will store
Customer data from different sources. The table will include a column that contains the CustomerID from the
source system and a column that contains the SourceID. You need to ensure that the table has no duplicate
CustomerID within a SourceID. You also need to ensure that the data in the table is in the order of SourceID
and then CustomerID.
Which Transact-SQL statement should you use?
a. CREATE TABLE Customer
(
SourceID int NOT NULL
IDENTITY(1,1),
CustomerID int NOT NULL
IDENTITY(1, 1),
CustomerName varchar(255) NOT
NULL
);
b. CREATE TABLE Customer
(
SourceID int NOT NULL,
CustomerID int NOT NULL
PRIMARY KEY CLUSTERED,
CustomerName varchar(255) NOT
NULL
);
c. CREATE TABLE Customer
(
SourceID int NOT NULL PRIMARY
KEY CLUSTERED,
CustomerID int NOT NULL
UNIQUE,
CustomerName varchar(255) NOT
NULL
);
d. CREATE TABLE Customer
(
SourceID int NOT NULL,
CustomerID int NOT NULL,
CustomerName varchar(255) NOT
NULL,
CONSTRAINT PK_Customer
PRIMARY KEY CLUSTERED
(SourceID, CustomerID)
);