unique column sql code example
Example 1: set column as unique in sql server
ALTER TABLE Persons
ADD UNIQUE (ID);
Example 2: distinct sql
Distinct: helps to displays the non duplicate
records when retrieving the records from a table.
SELECT DISTINCT FIRST_NAME FROM VISITORS;
Example 3: unique constraint mssql
USE AdventureWorks2012;
GO
CREATE TABLE Production.TransactionHistoryArchive4
(
TransactionID int NOT NULL,
CONSTRAINT AK_TransactionID UNIQUE(TransactionID)
);
GO