0% found this document useful (0 votes)
15 views1 page

Unique Records

Uploaded by

Pankaj Singh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views1 page

Unique Records

Uploaded by

Pankaj Singh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

1.

Unique records using DISTINCT clause

2.Get Unique Records using GROUP BY

3.Get Unique Records using UNIQUE keyword

select unique employee_id from job_hist;

4.Get Unique Records using MINUS Set Operator

SELECT employee_id FROM job_hist


MINUS
SELECT NULL FROM DUAL ;

5.Get Unique Records using UNION Set Operator

SELECT employee_id FROM job_hist


UNION
SELECT NULL FROM DUAL WHERE 1 = 2;

6.Get Unique Records using INTERSECT Set Operator

SELECT employee_id FROM job_hist


INTERSECT
SELECT employee_id FROM job_hist;

7.Get Unique Records using ROW_NUMBER ANALYTICAL Function

SELECT employee_id
FROM ( SELECT employee_id
,ROW_NUMBER() OVER (PARTITION BY employee_id ORDER BY 1) row_num
FROM job_hist
)
WHERE row_num = 1 ;

8.Get Unique Records using RANK or DENSE_RANK ANALYTICAL Function

9.Get Unique Records using Subquery

10.Get Unique Records using Subquery with AGGREGATE Function

11.Get Unique Records using EXIST Subquery

You might also like