Elimination of duplicates

By default, query results are displayed without eliminating duplicate values, eg:

SELECT DEPTNO
FROM EMP;

The DISTINCT keyword

Eliminating redundant value is obtained by using the DISTINCT keyword in the SELECT clause.

SELECT DISTINCT DEPTNO
FROM EMP;

You can also request a letter of refinement mutually different values ​​by entering the number in the SELECT clause column names.

The DISTINCT keyword applies to all column names appearing in the SELECT clause.

SELECT DISTINCT JOB, DEPTNO
FROM EMP;

No comments: