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

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

Why we use the openxml clause?

549


Define normalisation?

678


What is the contrast amongst drop and truncate?

562


How to create a ddl trigger using "create trigger" statements?

616


What is a fill factor?

627






How to send a ssrs report from ssis?

125


Every night you run a full backup after every 3 three hours you make a differential backup every hour you make an incremental backup in a worst-case scenario, how much work you can lose?

519


How many types of local tables are there in sql server?

510


What types of replication are supported in sql server?

571


What is sql server english query?

547


What do you mean by acid?

580


What is 'Join' and explain its various types.

630


How to convert numeric expression data types by assignment operations?

523


Where are sql server usernames and passwords stored in the sql server?

615


How to get the definition of a user defined function back?

571