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 WHOLE TABLES */
SELECT COUNT(*)
FROM FLUG, FLUGLINIE
WHERE (FLUG.FLC = FLUGLINIE.FLC);


/* SELECT ONE CONJUNCTIVE RESTRICTION */
SELECT FLUG.FLC, FLUG.FLNR, FLUGLINIE.NAME
FROM FLUG, FLUGLINIE
WHERE (FLUG.FLC = FLUGLINIE.FLC)
AND (FLUG.NACH = 'LHR');


/* SELECT ONE CONJUNCTIVE RESTRICTION */
SELECT PASSAGIER.NAME, PASSAGIER.VORNAME, BUCHUNG.BNR, BUCHUNG.FLC, BUCHUNG.FLNR
FROM PASSAGIER, BUCHUNG
WHERE (PASSAGIER.PNR = BUCHUNG.PNR)
AND (PASSAGIER.PNR <= 4);


/* SELECT ONE DISJUNCTIVE RESTRICTION ON ONE TABLE */
SELECT BUCHUNG.BNR, BUCHUNG.PNR, BUCHUNG.FLC, BUCHUNG.FLNR, BUCHUNG.FLNR, BUCHUNG.PREIS
FROM PASSAGIER, BUCHUNG
WHERE BUCHUNG.PNR = PASSAGIER.PNR
AND (PASSAGIER.PNR < 3 OR PASSAGIER.PNR = 1200);


/* SELECT ONE DISJUNCTIVE RESTRICTION ON ONE TABLE */
SELECT COUNT(*)
FROM PASSAGIER, BUCHUNG
WHERE (PASSAGIER.PNR = BUCHUNG.PNR)
AND (BUCHUNG.BNR <= 2000 OR BUCHUNG.NACH = 'LIM');


/* SELECT ONE DISJUNCTIVE RESTRICTION ON ONE TABLE */
SELECT COUNT(*)
FROM PASSAGIER, BUCHUNG
WHERE (PASSAGIER.PNR = BUCHUNG.PNR)
AND (BUCHUNG.VON = 'FRA' OR BUCHUNG.NACH = 'LHR');


/* SELECT TWO CONJUNCTIVE RESTRICTIONS ON ONE TABLE */
SELECT PASSAGIER.NAME, PASSAGIER.VORNAME, BUCHUNG.BNR, BUCHUNG.FLC, BUCHUNG.FLNR
FROM PASSAGIER, BUCHUNG
WHERE (PASSAGIER.PNR = BUCHUNG.PNR)
AND (BUCHUNG.BNR <= 2000) AND (BUCHUNG.NACH = 'LIM');


/* SELECT TWO CONJUNCTIVE RESTRICTIONS ONE PER TABLE */
SELECT PASSAGIER.NAME, PASSAGIER.VORNAME, BUCHUNG.BNR, BUCHUNG.FLC, BUCHUNG.FLNR
FROM PASSAGIER, BUCHUNG
WHERE (PASSAGIER.PNR = BUCHUNG.PNR)
AND (BUCHUNG.BNR <= 1500) AND (PASSAGIER.LAND = 'RSA');



rollback;

