Tag Archives: Distinct use

Use of DISTINCT in SQL Query

Distinct operator in SQL Query

DISTINCT is used for fetch the distinct value of specific column in Oracle table.

Select distinct columnname, columnname from tablename;

Example
I want to see distinct dept no in employee tables.

Select distinct deptno from employee;

You can pass two column to fetch distinct value of two columns:

select distinct first_name,last_name from employee;

Count the distinct number:
Count the distinct department from employee tables

select count(distinct deptno) from employees;