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

Define concurrency control. : Transact sql

1132


What are the types of variable use in pl sql?

1035


What is a data definition language?

1052


What are literals in sql server?

1108


Show how functions and procedures are called in a pl/sql block.

1073


Can we create index on primary key?

937


How do I run a script in sql developer?

915


Is grant a ddl statement?

871


What is rownum in sql?

994


what does myisamchk do? : Sql dba

982


Explian rowid, rownum? What are the psoducolumns we have?

962


How to rename a column in the output of sql query?

1037


What is the difference between sql and mysql?

1075


how to drop an existing index in mysql? : Sql dba

1036


What are all the different normalizations?

997