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
What is the difference between functions, procedures, and packages in pl/sql?
What is forward declaration in pl sql?
How to run sql functions in pl/sql?
Explain how you can copy a file to file content and file to pl/sql table in advance pl/sql?
Which is faster union or join?
What is set serveroutput on in pl sql?
What is embedded sql what are its advantages?
What does closing a cursor do?
table structure: ---------------- col1 col2 ----- ----- 01-mar-2012 11:12:46 01-mar-2012 11:12:10 01-mar-2012 11:12:46 01-mar-2012 11:11:23 Write a query to display the result as shown below: col1 col2 ----- ----- 01-mar-2012 11:12:46 01-mar-2012 11:12:10
what are different types of collation sensitivity? : Sql dba
Which column of the user triggers data dictionary view displays the database event that will fire the trigger?
Explain how can you save or place your msg in a table?
which types of join is used in sql widely? : Sql dba
How can you get sql*loader to commit only at the end of the load file? : aql loader
Why use stored procedures?