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 3 PARTITIONS */
SELECT FLC, COUNT(*) FROM BUCHUNG GROUP BY FLC;


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


/* SELECT GROUP BY HAVING WHERE 3 PARTITIONS */
SELECT NACH, COUNT(*) FROM BUCHUNG WHERE (VON = 'LHR') GROUP BY NACH HAVING COUNT (*) > 2;


/* SELECT GROUP BY HAVING WHERE 3 PARTITIONS */
SELECT NACH, AVG(PREIS) FROM BUCHUNG WHERE (VON = 'LHR') GROUP BY NACH HAVING COUNT (*) > 2;

/* SELECT GROUP BY HAVING WHERE 1 PARTITION */
SELECT NACH, AVG(PREIS) FROM BUCHUNG
WHERE (VON = 'CDG') AND (FLC='AF')
GROUP BY NACH HAVING COUNT (*) > 2;

rollback;

