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 “phantom rows”?

0 Answers  


Can you change the data type of a column in a table after the table has been created? If so, which command would you use?

0 Answers  


How To Make password Protected SQL Server 2005 Database i.e when i open SQL Server database then ask for password.

1 Answers  


How do use Having,Group by,Group function in SQL?

0 Answers  


What area unit the various kinds of info compression introduced in sql server 2008?

0 Answers  






Which sql server table is used to hold the stored procedure script?

0 Answers  


List out the different types of locks available in sql server?

0 Answers  


How do I create an extended event in sql server?

0 Answers  


What is the stuff and how does it differ from the replace function?

0 Answers  


How to declare and use cursor variables?

0 Answers  


Anyone please explain me the concept of Serialization?

3 Answers  


What is named query? : sql server analysis services, ssas

0 Answers  


Categories