user96824
0
Q:

sql unique

 SELECT DISTINCT column1, column2, ...

 FROM table_name; 
14
SELECT DISTINCT column1, column1, ..... FROM TABLE
/*DISTINCT WILL NOT SELECT THE SAME VALUES IN SAME COLUMN*/
5
SELECT DISTINCT Column_name FROM table_name;
7
ALTER TABLE Persons
ADD UNIQUE (ID);
0
-- To name a UNIQUE constraint, and to define a UNIQUE constraint on 
-- multiple columns, use the following SQL syntax:

-- MySQL / SQL Server / Oracle / MS Access:

CREATE TABLE Persons (
    ID int NOT NULL,
    LastName varchar(255) NOT NULL,
    FirstName varchar(255),
    Age int,
    CONSTRAINT UC_Person UNIQUE (ID,LastName)
); 
0
USE AdventureWorks2012;  
GO  
CREATE TABLE Production.TransactionHistoryArchive4  
 (  
   TransactionID int NOT NULL,   
   CONSTRAINT AK_TransactionID UNIQUE(TransactionID)   
);   
GO  

0

New to Communities?

Join the community