Oracle SQL Interview Questions And Answers For Freshers | Interview Preparation | Oracle SQL Tutorial Developer

Oracle Interview Questions And Answers

How to get unique records without using distinct clause? 

1) Get unique record using group by clause 
sql> select job, deptno from emp group by job, deptno order by job, deptno; 

2) Get unique record using unique keyword 
sql> select unique job, deptno from emp order by job, deptno; 

3) Get unique record using MINUS set operator 
sql> select job, deptno from emp minus select null, null from dual; 

4) Get unique record using UNION set operator 
sql> select job, deptno from emp union select null, null from dual where 1=2; 

5) Get unique record using intersect set operator 
sql> select job, deptno from emp intersect select job, deptno from emp; 

6) Get unique record row_number analytical function 
sql> select job, deptno from ( select job, deptno,row_number() over(partition by job, deptno order by 1) row_num from emp) where row_num=1;

Please do check our daily posts, videos for beneficial informations, in case of any additional queries please do contact us, we are happy to assist you.

Please Do SUBSCRIBE our Youtube Channel and Support us :-
https://www.youtube.com/a4uofficial

If any difficulties regarding our posts, videos or other problem you can direct contact us:- allforyoucreators@gmail.com

If you found this post was helpful then please don't forget to SUBSCRIBE our channel.
Subscribe us for more such posts, videos and updates.. It's Free!!

For Businesses Inquiries :- allforyoucreators@gmail.com
_____________________________________________________________________________

Join Us on Social Media -
Like our Facebook Page :- https://www.facebook.com/a4u0fficial/

PLEASE SUBSCRIBE US FOR MORE POSTS, VIDEOS AND STAY TUNED..
CREATIVE, INFORMATIVE & BENEFICIAL CONTENTS TO BE FOUND ON OUR CHANNEL!!
BECAUSE WE KEEP UPLOADING VIDEOS ON YOUTUBE FOR YOU..
ALL WE NEED IS YOUR SUPPORT ❤

=▶ Thanks for your Love and Support ◀=

Copyright ©All For You Official

Post a Comment

0 Comments