(GRO_ID) REFERENCES GROMADY (GRO_ID))
PROMPT Creating Foreign Key on 'SEKTORY' ALTER TABLE SEKTORY ADD (CONSTRAINT SEK_KIE_FK FOREIGN KEY (KIE_ID) REFERENCES KIEROWNICY (KIE_ID))
PROMPT Creating Foreign Key on 'RODZAJE' ALTER TABLE RODZAJE ADD (CONSTRAINT RODZ_ROD_FK FOREIGN KEY (ROD_ID) REFERENCES RODZINY (ROD_ID))
CREATE |
SEQUENCE |
mag |
seq |
NOMAXVALUE |
NOMINYALUE |
NOCYCLE; |
CREATE |
SEQUENCE |
sek |
seq |
NOMAXYALUE |
NOMINYALUE |
NOCYCLE; |
CREATE |
SEQUENCE |
kie |
seq |
NOMAXVALUE |
NOMINYALUE |
NOCYCLE; |
CREATE |
SEQUENCE |
jed |
seq |
NOMAXVALUE |
NOMINYALUE |
NOCYCLE; |
CREATE |
SEQUENCE |
kar |
seq |
NOMAXVALUE |
NOMINYALUE |
NOCYCLE; |
CREATE |
SEQUENCE |
opi |
seq |
NOMAXVALUE |
NOMINYALUE |
NOCYCLE; |
CREATE |
SEQUENCE |
zwi |
seq |
NOMAXVALUE |
NOMINYALUE |
NOCYCLE; |
CREATE |
SEQUENCE |
kia |
seq |
NOMAXVALUE |
NOMINYALUE |
NOCYCLE; |
CREATE |
SEQUENCE |
spo |
seq |
NOMAXVALUE |
NOMINYALUE |
NOCYCLE; |
CREATE |
SEQUENCE |
wpl |
seq |
NOMAXVALUE |
NOMINYALUE |
NOCYCLE; |
CREATE |
SEQUENCE |
bad |
seq |
NOMAXVALUE |
NOMINYALUE |
NOCYCLE; |
CREATE |
SEQUENCE |
cho |
seq |
NOMAXVALUE |
NOMINYALUE |
NOCYCLE; |
CREATE |
SEQUENCE |
wet |
seq |
NOMAXVALUE |
NOMINYALUE |
NOCYCLE; |
CREATE |
SEQUENCE |
gat |
seq |
NOMAXVALUE |
NOMINYALUE |
NOCYCLE; |
CREATE |
SEQUENCE |
rodź seq NOMAXVALUE NOMINYALUE NOCYCLE | ||||
CREATE |
SEQUENCE |
rod |
seq |
NOMAXVALUE |
NOMINYALUE |
NOCYCLE; |
CREATE |
SEQUENCE |
rza |
seq |
NOMAXVALUE |
NOMINYALUE |
NOCYCLE; |
CREATE |
SEQUENCE |
gro |
seq |
NOMAXVALUE |
NOMINYALUE |
NOCYCLE; |
CREATE |
SEQUENCE |
typ_ |
seq |
NOMAXVALUE |
NOMINYALUE |
NOCYCLE; |
PROMPT Creating View 'gatunki_zwierzat'
CREATE OR REPLACE VIEW gatunki_zwierzat (numer_klatki, nazwa_klatki, imie_zwierzaka, gatunek)
AS SELECT k.kla_id, k.nazwa, z.imię, g.nazwa
FROM zwierzaki z LEFT OUTER JOIN klatki k ON z.kla_id=k.kla_ LEFT OUTER JOIN gatunki g ON z.gat_id=g.gat_id /
PROMPT Creating View 'sponsoring'
CREATE OR REPLACE VIEW sponsoring (data, sponsor, kwota, imie_zwierzaka)
AS SELECT to_char(data,'yyyy-mon-dd'), nazwa, kwota, imię FROM wpłaty NATURAL JOIN zwierzaki NATURAL JOIN sponsorzy ORDER BY data /
PROMPT Creating Trigger 'aktualizacja_magazynu'
CREATE OR REPLACE TRIGGER aktualizacja_magazynu AFTER INSERT ON porcje FOR EACH ROW DECLARE
obecnie number(8,0);
BEGIN
SELECT stan INTO obecnie FROM zapasy WHERE jed_id=:NEW.jed UPDATE zapasy SET stan=obecnie-:NEW.ile WHERE jed_id=:NEW. IF obecnie-:NEW.ile<50 THEN UPDATE zapasy SET uwagi='malo' WHERE jed_id=:NEW.jed id;