Oracle SQL - Count different courses are scheduled for each trainer and the total number of scheduled courses

Introduction

The following code shows how many different courses are scheduled for each trainer and the total number of scheduled courses.

Demo

SQL>
SQL> select trainer
  2  ,      count(distinct course)--   ww  w  .  j a  va 2  s .co m
  3  ,      count(*)
  4  from   offerings
  5  group  by trainer;

  TRAINER | COUNT(DISTINCTCOURSE) |  COUNT(*)
--------- | --------------------- | ---------
 [N/A]    |              00003.00 |  00003.00
 07004.00 |              00002.00 |  00002.00
 07001.00 |              00002.00 |  00003.00
 07902.00 |              00002.00 |  00002.00
 07008.00 |              00002.00 |  00002.00
 07011.00 |              00001.00 |  00001.00

6 rows selected.

SQL>

Related Topic