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

How to truncate a table first before running a package?

1 Answers  


How do you check the performance of a query and how do you optimize it?

1 Answers  


Define model database?

0 Answers  


What do you understand by mirroring and mention the advantages of the mirroring?

0 Answers  


Diffrence between DTS vs SSIS

2 Answers   IBM, Infosys,






Indexes are updated automatically is the full-text index also updated automatically?

0 Answers  


A table contains list of customers and his city with other details. Each customer has a unique number and the table consists millions of data. Query is: I want to retrieve 10 customers from each city, no script, only from single query?

8 Answers   Infosys,


Does an index slow down updates on indexed columns?

0 Answers  


Can select statements be used on views in ms sql server?

0 Answers  


How do we know if any query is retrieving a large amount of data or very little data?

0 Answers  


hi,i want t0 knom d syntax for a super key with an example

1 Answers  


Write a query to get all details of employee who has maximum salary from employee table

8 Answers   AON, Genpact,


Categories