top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How does one count different data values in a column In Oracle?

+2 votes
342 views
How does one count different data values in a column In Oracle?
posted Jun 19, 2015 by Kunal Kapoor

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes
SQL>create table rb as select rownum A, rownum b , rownum c from dual connect by level < 11;

Table created.

Elapsed: 00:00:00.31
SQL>select count(distinct a) from Rb 
  2  union all
  3  select count(distinct B ) from Rb
  4  union all
  5  select count(distinct c) from Rb
  6  /

COUNT(DISTINCTA)
----------------
              10
              10
              10

Elapsed: 00:00:00.53
SQL>update rb set b = 3 where B > 5;

5 rows updated.

Elapsed: 00:00:00.26
SQL>commit;

Commit complete.

Elapsed: 00:00:00.26
SQL>select count(distinct a) from Rb 
  2   union all
  3   select count(distinct B ) from Rb
  4   union all
  5   select count(distinct c) from Rb
  6   /

COUNT(DISTINCTA)
----------------
              10
               5
              10

Elapsed: 00:00:00.53
SQL>
answer Jun 22, 2015 by Manikandan J
...