Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

Differences between UNIQUE and DISTINCT in select statements

Answer Posted / manoj

see cautiously the major difference b/w unique and
distinct

UNIQUE :Allways take part on DATA INSERTION (In brief)
DINTINCT:Allways concern on data retrival (In brief)

Now we will take following case
when

case 1: UNIQUE KEY is defined (may b 4 one or more column)

It means this constraint will not allow us to
INSERT duplicate record/column_value(s)(i.e. exactly
same record/column_value(s) again for specified key column
(s)only)


NOW if u use DISTINCT clause in query
(select DISTINCT.from.)the will b same as simple query
(select....from...)

Bcoz data are already not repeated (bcoz of constraint)


case 2:if UNIQUE not defined

data may b repeated and DISTINCT will now useful


Have eye on Major difference

(and we never use UNIQUE CONS.. in select.....)

Is This Answer Correct ?    40 Yes 31 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is field delimiter?

1040


How do I run a sql query?

1009


how to write date and time literals? : Sql dba

956


Does a primary key have to be a number?

961


How to Execute a Package in PL/SQL.?

1193


How do I write a cron which will run a sql query and mail the results to agroup?

970


What is procedure function?

1049


What is a .db file?

979


What do you mean by stored procedures? How do we use it?

993


What is mutating trigger?

1017


Can we use threading in pl/sql?

1034


What is recursive join in sql?

1003


Explain the difference in execution of triggers and stored procedures?

1014


how would you enter characters as hex numbers? : Sql dba

975


Does pdo prevent sql injection?

926