René Nyffenegger's collection of things on the web
René Nyffenegger on Oracle - Most wanted - Feedback
 

distinct [Oracle SQL]

create table distinct_example (
  a number
);
insert into distinct_example values (   5);
insert into distinct_example values (   2);
insert into distinct_example values (   4);
insert into distinct_example values (   2);
insert into distinct_example values (null);
insert into distinct_example values (   4);
insert into distinct_example values (   3);
Select all distinct a's from distinct_example:
select distinct a
  from distinct_example;
         A
----------

         2
         5
         4
         3
Counting how many distinct values there are in the table:
select count (distinct a) 
  from distinct_example;
COUNT(DISTINCTA)
----------------
               4