Snippet Name: Distinct
Description: The DISTINCT clause allows you to remove duplicates from the result set. The DISTINCT clause can only be used with select statements.
Also see: » AND Condition
» Having Clause
» EXISTS 2
» EXISTS
» WITH with CONNECT BY
» WITH Clause: Single alias
» WITH Clause: Double alias
Comment: Unique can be used in place of distinct. The effect is the same.
Language: PL/SQL
Highlight Mode: PLSQL
Last Modified: March 07th, 2009
|
The syntax FOR the DISTINCT clause IS:
SELECT DISTINCT columns
FROM tables
WHERE predicates;
Let's take a look at a very simple example.
SELECT DISTINCT city
FROM suppliers;
This SQL statement would return all unique cities from the suppliers table.
|