What is the difference between UNIQUE and DISTINCT keywords in DBMS?



What is the difference between UNIQUE and DISTINCT keywords in DBMS?..

Answer / anjaligarg

First we declare is as primary key and after group by we can get uniqu values.

CREATE TABLE Persons (
ID int NOT NULL,
LastName varchar(255) NOT NULL,
FirstName varchar(255),
Age int,
PRIMARY KEY (ID)
);

SELECT ID, LastName,FirstName
FROM Persons
GROUP BY ID, LastName,FirstName;

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More SQL Server Interview Questions

What are indexers?

0 Answers  


What is the default server name for sql server?

0 Answers  


When do u use clustered index and non-clustered index?

3 Answers   IBM,


What is the use of @@spid?

0 Answers  


i have 4 tables.. T1, T2, T3, T4.. these tables have the same structure and they store the information entered in different years.. T1 stored 2002, T2 stored 2003, T3 stored 2004 and T4 stored 2005.. i want to copy contents in T1 to T2, T2 to T3, T3 to T4 and T4 to T1.. how do i do that? Temp tables cannot be used..

4 Answers  






how many instance use in sql server 2005

4 Answers   EFI, HCL,


What will happen if a column containing char type data is changed to the nchar data type?

0 Answers  


How to find tables without indexes?

0 Answers  


What is the main difference between ‘between’ and ‘in’ condition operators?

0 Answers  


What is a bit datatype?

0 Answers  


How many index can be created for single table

4 Answers   CarrizalSoft Technologies, Verizon,


Tell me about the approaches which you used to counter the DI problems.

0 Answers   EXL,


Categories