:mad: :mad: Is threre any difference bet 'disinct' and 'unique' key word used in select clause
ex
select disinct(column_name) from table_name;
select unique(column_name) from table_name;:rolleyes:
Printable View
:mad: :mad: Is threre any difference bet 'disinct' and 'unique' key word used in select clause
ex
select disinct(column_name) from table_name;
select unique(column_name) from table_name;:rolleyes:
Hi Smitai,
The keywords, [B]DISTINCT and UNIQUE are synonymous[/B].
Both are used to specify to return only one copy of each set of duplicate rows selected.
One restriction is that DISTINCT cannot be specified if the FROM clause contains LOB columns.
*** Innila ***
UNIQUE we are inserting unique data to table
DISTINCT means we are retriving unique values from duplicate records
Both are same but distinct use in sql as well in oracle but unique only use for oracle
[B]Unique:[/B]
[B]SQL>[/B] insert into emp values(eno number(4) unique,ejob varchar(15));
Here unique restricts the user to enter the same value more than once.
[B]Error:Voilating constraint
[/B]
[B]Distinct:[/B]
[B]SQL>[/B]select distinct(ejob) from emp;
Here distinct is used to eliminate the duplicate values from emp. i.e ejob