ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
tip   SiteMap shows list of All Categories in this site.
Google
 
Categories  >>  Software  >>  Databases  >>  SQL PLSQL
 
 


 

 
 Oracle interview questions  Oracle Interview Questions
 SQL Server interview questions  SQL Server Interview Questions
 MS Access interview questions  MS Access Interview Questions
 MySQL interview questions  MySQL Interview Questions
 Postgre interview questions  Postgre Interview Questions
 Sybase interview questions  Sybase Interview Questions
 DB Architecture interview questions  DB Architecture Interview Questions
 DB Administration interview questions  DB Administration Interview Questions
 DB Development interview questions  DB Development Interview Questions
 SQL PLSQL interview questions  SQL PLSQL Interview Questions
 Databases AllOther interview questions  Databases AllOther Interview Questions
Question
Differences between UNIQUE and DISTINCT in select statements
 Question Submitted By :: Cutepa1
I also faced this Question!!     Rank Answer Posted By  
 
  Re: Differences between UNIQUE and DISTINCT in select statements
Answer
# 1
UNIQUE and DISTINCT
 
Is This Answer Correct ?    1 Yes 4 No
Guest
 
  Re: Differences between UNIQUE and DISTINCT in select statements
Answer
# 2
UNIQUE(Constraint):- Can be only once for a   column in  a  
table


DISTINCT(Clause):- Useed in select query to retrive distinct
(non repeated) data from table(s)
 
Is This Answer Correct ?    3 Yes 3 No
Manoj
 
 
 
  Re: Differences between UNIQUE and DISTINCT in select statements
Answer
# 3
Yeah Manoj, Thatz ok, UNIQUE as a constraint. But I like to
know about the diff while its usage in select statement. For
me it seems very similar to DISTINCT, can anyone give me if
there is any difference, please.
 
Is This Answer Correct ?    0 Yes 0 No
Cutepa1
[Verinon]
 
  Re: Differences between UNIQUE and DISTINCT in select statements
Answer
# 4
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 ?    1 Yes 1 No
Manoj
 
  Re: Differences between UNIQUE and DISTINCT in select statements
Answer
# 5
yeah Manoj, this was analysed with your previous answer
itself  but please try these statements and help me with
it's significance on the statements.
select unique(<clomun_name>) from <table_name>;
select distinct(<clomun_name>) from <table_name>;
 
Is This Answer Correct ?    0 Yes 0 No
Cutepa1
[Verinon]
 
  Re: Differences between UNIQUE and DISTINCT in select statements
Answer
# 6
Buddy i dont found any difference in using distinct and 
unique in the select statement, as both are performing same 
operation in the select statement, almost every diff you 
have discussed i want to add one that is u cant use 
distinct in the create whereas unique u can.
 
Is This Answer Correct ?    1 Yes 0 No
Gourvendra Singh
 
  Re: Differences between UNIQUE and DISTINCT in select statements
Answer
# 7
the diff between unique and distinct is 
unique is applied before insertion and retrival.it consists
of non duplicate values.if unique constraint is given it
does not take duplicate values.distinct is used in retrival
it gives the suppressed row(ex  if two rows are same it will
show single row and non duplicate row) therefore distinct is
the combination of  suppressed duplicate and non duplicate rows.
 
Is This Answer Correct ?    2 Yes 1 No
Chandra Sekhar
 
  Re: Differences between UNIQUE and DISTINCT in select statements
Answer
# 8
DISTINCT AND UNIQUE are same operation.
But, You cannot specify DISTINCT if the select_list 
contains LOB columns.
 
Is This Answer Correct ?    2 Yes 0 No
Howard Cheon
 
  Re: Differences between UNIQUE and DISTINCT in select statements
Answer
# 9
Hi Howard Cheon,
               you are currect... but we cant able to use 
both DISTINCT and UNIQUE, if the select_list contains LOB, 
LONG columns. It may not a difference.

Could anyone plz give some another major difference..

Thanks in Advance

Vijay Reddy.
 
Is This Answer Correct ?    0 Yes 0 No
Vijay Mohan Reddy
 

 
 
 
Other SQL PLSQL Interview Questions
 
  Question Asked @ Answers
 
What is the result, when NULL is compared with NULL? TCS10
How to convert ms-excel file to oracle table?  2
Types of indexes. What is the default key created when a primary key is created in a table ? TCS4
check whether all the emp numbers are indeed unique.  3
what is the purpose of update command in oracle? MBT6
What is Pragma EXECPTION_INIT ? Explain the usage ?  1
Explain the usage of WHERE CURRENT OF clause in cursors ? Satyam2
In a package if we have 10 procedures or functions,How to know which will execute first?  1
Can we use more than one null value for unique key? A1-Technology15
what is global variable in package  1
What is INSTEAD OF trigger ? TCS5
how to debugg a procedure or package using dbms_output.put_line in plsql Polaris1
What is Overloading of procedures ?  3
Hi, Can anybody please explain me the flow of the below query. I am not able to understand how this query works. This query is for finding the Nth highest salary.. SELECT DISTINCT (a.sal) FROM EMP A WHERE &N = (SELECT COUNT (DISTINCT (b.sal)) FROM EMP B WHERE a.sal<=b.sal); If N = 2 then second highest salary will be the o/p. If N = 3 then third highest salary will be the o/p. and so on.. Thanks, Nitin Ness-Technologies4
i want to display 1 to 10 numbers using one select statement. Oracle4
in procedure how to return a value Wipro3
wht is the difference between sqlaserver2000 and 2005 ABC1
what is definer rights invoke rights?  1
What is a trigger ? BirlaSoft6
what is inline command?  2
 
For more SQL PLSQL Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com