SQL>
SQL>
SQL> create table course_schedule
2 ( course VARCHAR2(6)
3 , begindate DATE
4 , trainer NUMBER(4)
5 , location VARCHAR2(20)) ;
Table created.
SQL>
SQL>
SQL> insert into course_schedule values ('SQL',date '1999-04-12',1,'VANCOUVER' );
1 row created.
SQL> insert into course_schedule values ('OAU',date '1999-08-10',2,'CHICAGO');
1 row created.
SQL> insert into course_schedule values ('SQL',date '1999-10-04',3,'SEATTLE');
1 row created.
SQL> insert into course_schedule values ('SQL',date '1999-12-13',4,'DALLAS' );
1 row created.
SQL> insert into course_schedule values ('JAV',date '1999-12-13',5,'SEATTLE');
1 row created.
SQL> insert into course_schedule values ('XML',date '2000-02-03',6,'VANCOUVER' );
1 row created.
SQL> insert into course_schedule values ('JAV',date '2000-02-01',7,'DALLAS' );
1 row created.
SQL> insert into course_schedule values ('PLS',date '2000-09-11',8,'VANCOUVER' );
1 row created.
SQL> insert into course_schedule values ('XML',date '2000-09-18',NULL,'SEATTLE');
1 row created.
SQL> insert into course_schedule values ('OAU',date '2000-09-27',9,'DALLAS' );
1 row created.
SQL> insert into course_schedule values ('ERM',date '2001-01-15',10, NULL );
1 row created.
SQL> insert into course_schedule values ('PRO',date '2001-02-19',NULL,'VANCOUVER' );
1 row created.
SQL> insert into course_schedule values ('RSD',date '2001-02-24',8,'CHICAGO');
1 row created.
SQL>
SQL>
SQL> select trainer
2 , count(distinct course)
3 , count(*)
4 from course_schedule
5 group by trainer;
TRAINER COUNT(DISTINCTCOURSE) COUNT(*)
---------- --------------------- ----------
1 1 1
2 1 1
3 1 1
4 1 1
5 1 1
6 1 1
7 1 1
8 2 2
9 1 1
10 1 1
2 2
11 rows selected.
SQL>
SQL> drop table course_schedule;
Table dropped.
SQL>
SQL>
|