SHOW:
|
|
- or go back to the newest paste.
1 | create table etat_01( | |
2 | nazwa varchar2(20) constraint nazwa_pk primary key, | |
3 | placa_min number(6,2) not null check(placa_min>0), | |
4 | placa_max number(6,2) not null check(placa_max<=5000) | |
5 | ); | |
6 | ||
7 | create table zespol_01( | |
8 | id_zesp number(2) constraint id_zesp_pk primary key, | |
9 | nazwa varchar2(20) not null, | |
10 | adres varchar2(20) | |
11 | ); | |
12 | ||
13 | create table pracownik_03( | |
14 | numer number(4) constraint numer2_pk primary key, | |
15 | nazwisko varchar2(15) not null, | |
16 | etat varchar2(20) references etat_01(nazwa), | |
17 | szef number(4) references pracownik_03(numer), | |
18 | pracuje_od date, | |
19 | placa_pod number(6,2), | |
20 | placa_dod number(6,2) default 0, | |
21 | id_zesp number(2) references zespol_01(id_zesp) | |
22 | ); | |
23 | ||
24 | insert into etat_01 | |
25 | values('stazysta',800,1000); | |
26 | ||
27 | insert into etat_01 | |
28 | values('sekretarka',900,1200); | |
29 | insert into etat_01 | |
30 | values('asystent',1000,1600); | |
31 | insert into etat_01 | |
32 | values('adiunkt',1600,2000); | |
33 | insert into etat_01 | |
34 | values('profesor',2000,2500); | |
35 | insert into etat_01 | |
36 | values('dyrektor',2500,3200); | |
37 | ||
38 | ||
39 | insert into zespol_01 values(10,'administracja','piotrowo 3a'); | |
40 | insert into zespol_01 values(20,'bazy danych','wiezowa 75'); | |
41 | insert into zespol_01 values(30,'sieci komputerowe','garbary 3'); | |
42 | insert into zespol_01 values(40,'systemy operacyjne','piotrowo 3a'); | |
43 | insert into zespol_01 values(50,'translatory','mansfelda 4'); | |
44 | ||
45 | insert into pracownik_03 values(1000,'lech','dyrektor',null,to_date('01/01/71','dd/mm/yy'),3160,570,10); | |
46 | insert into pracownik_03 values(1080,'koliberek','sekretarka',1000,to_date('20/02/83','dd/mm/yy'),1150,null,10); | |
47 | insert into pracownik_03 values(1010,'podgajny','profesor',1000,to_date('01/05/75','dd/mm/yy'),2180,420,20); | |
48 | insert into pracownik_03 values(1040,'rus','adiunkt',1010,to_date('15/08/79','dd/mm/yy'),1750,null,20); | |
49 | insert into pracownik_03 values(1070,'muszynski','adiunkt',1010,to_date('01/05/85','dd/mm/yy'),1600,null,20); | |
50 | insert into pracownik_03 values(1060,'misiecki','asystent',1010,to_date('01/03/85','dd/mm/yy'),1400,null,20); | |
51 | insert into pracownik_03 values(1090,'palusz','asystent',1040,to_date('15/08/89','dd/mm/yy'),1200,null,20); | |
52 | ||
53 | select nazwisko,etat,placa_pod from pracownik_03 where id_zesp=10 or id_zesp=20 order by nazwisko; | |
54 | select nazwisko, etat from pracownik_03 where etat='asystent' and id_zesp=20; | |
55 | ||
56 | select 'Pracownik ' || nazwisko || ' pracuje na etacie ' ||etat ||' od ' ||pracuje_od from pracownik_03; | |
57 | ||
58 | select d.nazwisko, a.nazwa, a.adres from pracownik_03 d, zespol_01 a where d.placa_pod+d.placa_dod>2000 and a.id_zesp=d.id_zesp; |