set echo on;

alter session set nls_language = english;
alter session set nls_date_format = 'DD-MON-YYYY';
alter session set nls_date_language = english;


/* SELECT GROUP BY */
SELECT FLC, COUNT(*) FROM FLUG GROUP BY FLC;


/* SELECT GROUP BY WHERE */
SELECT FLC, COUNT(*) FROM FLUG WHERE (VON = 'FRA') GROUP BY FLC;


/* SELECT GROUP BY WHERE NOTHING */
SELECT FLC, COUNT(*) FROM FLUG WHERE (VON = 'ZZZ') GROUP BY FLC;


/* SELECT GROUP BY HAVING */
SELECT PNR, SUM(MEILEN) FROM BUCHUNG GROUP BY PNR HAVING COUNT (*) = 1;


/* SELECT GROUP BY HAVING WHERE */
SELECT VON, MAX(PREIS) FROM BUCHUNG WHERE (BNR > 20) GROUP BY VON HAVING COUNT (*) > 2;

rollback;
  