Differences between UNIQUE and DISTINCT in select statements

Answer Posted / apparao akki

Hi all,

plz find the below executed report on the same.
------------------------------------------------------


SQL> select * from person;

PERSON_ID FIRST_NAME LAST_NAME
TITLE_1 TITLE_2 SOCS
---------- --------------------- -------------------------
---------- ---------- -----------
9 ssss rrrrr
tttt gggg 67778-3
1 THUUTHTUT lofstrom
ba null 4940-343
1 ffsdf fsdfsd
fdsfsd fsdf 5454
1 THUUTHTUT lofstrom
ba null 4940-343
1 THUUTHTUT lofstrom
ba null 4940-343
1 appa akki
s/w btech 3i
2 rao
s/w kmm 3i
4 bunny neel
lkg ukg home

8 rows selected.

SQL> select unique(person_id),last_name from person;

PERSON_ID LAST_NAME
---------- -------------------------
2
1 lofstrom
4 neel
1 fsdfsd
9 rrrrr
1 akki

6 rows selected.

SQL> select distinct(person_id) from person;

PERSON_ID
----------
4
9
2
1

Is This Answer Correct ?    9 Yes 20 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between a primary key and a clustered index?

713


Can we use ddl statements in stored procedure?

900


What are the differences between implicit and explicit cursors?

727


Is sql a oracle?

710


Define tables and fields in a database

852


How to get unique records from a table?

688


What is the unique index?

747


What is sql and how does it work?

756


what is the difference between union and union all? : Sql dba

737


Is sql between inclusive?

803


What is assignment operator in pl sql?

784


How do I debug a stored procedure?

840


What is a sql profiler?

785


How to place comments in pl/sql?

814


How can you view the errors encountered in a trigger?

753