--1

--SELECT J.*
--FROM J JOIN SPJ ON J.JRBR=SPJ.JRBR
--WHERE PRBR='P1' AND KOL>15;

--2
--SELECT PX.PRBR, PY.PRBR, PX.TEZINA
--FROM P AS PX, P AS PY
--WHERE PX.TEZINA=PY.TEZINA AND PX.PRBR<PY.PRBR;

--3
--SELECT P.*, SRBR, JRBR
--FROM P LEFT OUTER JOIN SPJ ON P.PRBR=SPJ.PRBR;

--SELECT P.*, SRBR, JRBR
--FROM SPJ RIGHT OUTER JOIN P ON P.PRBR=SPJ.PRBR;

--4
-- bez podupita

--SELECT DISTINCT JIME
--FROM J JOIN SPJ ON J.JRBR=SPJ.JRBR
--WHERE PRBR='P3';

-- sa podupitom

--SELECT JIME
--FROM J
--WHERE JRBR IN (SELECT JRBR
--               FROM SPJ
--               WHERE PRBR='P3');

--SELECT JIME
--FROM J
--WHERE 'P3' IN ( SELECT PRBR
--                             FROM SPJ
--                             WHERE J.JRBR=SPJ.JRBR);

--5
--SELECT DISTINCT SRBR
--FROM SPJ
--WHERE PRBR NOT IN ( SELECT PRBR
--                    FROM SPJ
--                    WHERE SRBR='S2');

--6
--SELECT JIME
--FROM J
--WHERE EXISTS ( SELECT *
--               FROM SPJ
--               WHERE SPJ.JRBR=J.JRBR AND SRBR='S4');

--7
--SELECT JIME
--FROM J
--WHERE NOT EXISTS ( SELECT *
--                   FROM P
--                   WHERE NOT EXISTS ( SELECT *
--                                      FROM SPJ
--                                      WHERE PRBR=P.PRBR AND JRBR=J.JRBR));

--8
--SELECT JIME
--FROM J
--WHERE NOT EXISTS ( SELECT *
--                   FROM   P
--                   WHERE BOJA='Crvena' AND NOT EXISTS ( SELECT *
--                                                        FROM SPJ
--                                                        WHERE PRBR=P.PRBR AND JRBR=J.JRBR));

--9
--SELECT SIME
--FROM S
--WHERE NOT EXISTS ( SELECT *
--                   FROM J
--                   WHERE S.GRAD=J.GRAD AND NOT EXISTS ( SELECT *
--                                                        FROM SPJ
--                                                        WHERE SPJ.SRBR=S.SRBR AND SPJ.JRBR=J.JRBR));
--

--10
SELECT *
FROM S
WHERE STATUS >= ALL ( SELECT STATUS
                      FROM S);

--11
--SELECT *
--FROM P
--WHERE NOT TEZINA >= ALL ( SELECT TEZINA
--                      FROM P);


--SELECT *
--FROM P
--WHERE TEZINA < ANY ( SELECT TEZINA
--                      FROM P);





