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 ORDER BY */
SELECT * FROM FLUGLINIE ORDER BY LAND ASC;
SELECT * FROM FLUGLINIE ORDER BY LAND DESC;


/* SELECT ORDER BY WHERE */
SELECT PNR, NAME, LAND FROM PASSAGIER WHERE PNR <= 10 ORDER BY NAME ASC;


/* SELECT ORDER BY GROUP BY */
SELECT FLC, COUNT(*) FROM BUCHUNG GROUP BY FLC ORDER BY 2 DESC;


/* SELECT GROUP BY HAVING */
SELECT TAGINT, SUM(MEILEN) FROM BUCHUNG GROUP BY TAGINT HAVING COUNT (*) > 110;


/* SELECT GROUP BY HAVING WHERE */
SELECT FLC, SUM(MEILEN) FROM BUCHUNG WHERE (VON = 'CDG') GROUP BY FLC HAVING COUNT (*) > 2;

rollback;

