DISTINCT clause in Oracle. How it differs from UNIQUE clause?

Basically for all new Oracle SQL learning people it is quite necessary to get knowledge on DISTINCT clause. As experienced persons are very much well-versed with DISTINCT clause they can skip this article and relax in their arm chair for time being (though there are many interesting articles you can go through in OracleMine).


Simple use of DISTINCT clause is to retrieve only single set of duplicate records if used in SQL statement. SELECT clause retrieves total number of rows when run. Using DISTINCT clause will restrict duplicate records and instead show only one copy of it.



DISTINCT clause can also be used with multiple fields to return unique combination of those columns.


How does DISTINCT clause differs from UNIQUE clause?

DISTINCT and UNIQUE clause are similar to each other. Only difference is UNIQUE clause is proprietary of Oracle while DISTINCT clause is an SQL standard. For other databases like MySQL, MSSQL etc. UNIQUE clause is not identifiable.

In general practice we use DISTINCT clause instead of UNIQUE clause.

Syntax of UNIQUE clause


If you liked the above post, please leave your comments.

You can also Subscribe here to stay updated on latest posts of OracleMine.com.

Hi I am Paras.

Thanks for stopping by at OracleMine.com. Speaking about my brief introduction, I work for a multinational organisation in Oracle related technologies. Being an avid blogger, I would like to inform you about my productivity and motivational blog XpressPlanet.com. Speaking of OracleMine.com, I will try my best to share knowledge on technologies in as simple and understandable manner as possible. You can also contribute your knowledge on OracleMine by writing to us at hioraclemine@gmail.com. Again I appreciate your visit. Hope to see you again and again!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.