Discussion :: Introduction to SQL - General Questions (Q.No.19)
To remove duplicate rows from the results of an SQL SELECT statement, the ________ qualifier specified must be included.
Answer: Option C
No answer description available for this question.
|Shashi said: (Jul 22, 2011)|
|Distinct remove the duplicate rows from the row.|
|Aditya Harsha.R said: (Jul 26, 2011)|
|Yes. Because Its Keyword .
SELECT DISTINCT column_name(s)
P_Id LastName FirstName Address City
SELECT DISTINCT City FROM Persons
The result-set will look like this:
I think its Right.
|Rajendra said: (Jul 23, 2013)|
|Oracle official documentation:
DISTINCT | UNIQUE
Specify DISTINCT or UNIQUE if you want the database to return only one copy of each set of duplicate rows selected. These two keywords are synonymous. Duplicate rows are those with matching values for each expression in the select list.
|Pradeep said: (Aug 18, 2013)|
|What about UNIQUE keyword ?
Both unique and distinct are same ?
|Vasanth said: (Sep 3, 2014)|
|Really unique and distinct keywords are same?|
|Manoj said: (Sep 4, 2016)|
|Unique is for primary key, distinct removes duplicity in data.|
|Kishor said: (Nov 10, 2016)|
|Select unique * from emp, it is also showed unique data.|
|Hrishikesh Joshi said: (Nov 24, 2017)|
|"Specify DISTINCT or UNIQUE if you want Oracle to return only one copy of each set of duplicate rows selected (these two keywords are synonymous). Duplicate rows are those with matching values for each expression in the select list.
So, there should be no difference in the two (performance or otherwise) as they are treated the same by Oracle.
On another note, don't try to use UNIQUE in SELECT statements for other databases (MySQL, PostgreSQL, etc). You get up with an error because ANSI standards use DISTINCT with SELECT statements. Using UNIQUE with SELECT statements is just a product-specific remnant of older Oracle DBs created before the ANSI standard was born.
|Azhar said: (Jun 11, 2019)|
|Unique is constraint but distinct is not a constraint.|
Post your comments here:
Email : (optional)
» Your comments will be displayed only after manual approval.