1 | drop table if exists Vraboten_vo_oddel;
|
---|
2 | drop table if exists Otsustva;
|
---|
3 | drop table if exists Vraboteni;
|
---|
4 | drop table if exists Oddeli;
|
---|
5 | drop table if exists Firmi;
|
---|
6 | drop table if exists Vidovi;
|
---|
7 |
|
---|
8 | create table Vidovi(
|
---|
9 | vid_id integer primary key not null,
|
---|
10 | vid_otsustvo varchar(100) not null
|
---|
11 | );
|
---|
12 |
|
---|
13 | create table Firmi(
|
---|
14 | f_id integer primary key not null,
|
---|
15 | f_ime varchar(100) not null,
|
---|
16 | f_grad varchar(100) not null,
|
---|
17 | f_email varchar(100) not null,
|
---|
18 | f_telefon varchar(100) not null,
|
---|
19 | f_edb varchar(100) not null,
|
---|
20 | f_kontakt varchar(100),
|
---|
21 | f_username varchar(100) not null,
|
---|
22 | f_password varchar(100) not null,
|
---|
23 | f_valid date not null
|
---|
24 | );
|
---|
25 |
|
---|
26 | create table Oddeli(
|
---|
27 | oddel_id serial primary key not null,
|
---|
28 | oddel_naziv varchar(100) not null,
|
---|
29 | f_id integer not null references Firmi(f_id)
|
---|
30 | );
|
---|
31 |
|
---|
32 | create table Vraboteni(
|
---|
33 | v_id serial primary key not null,
|
---|
34 | v_ime varchar(100) not null,
|
---|
35 | v_prezime varchar(100) not null,
|
---|
36 | v_mesto varchar(100),
|
---|
37 | v_telefon varchar(100),
|
---|
38 | v_embg varchar(100) not null,
|
---|
39 | v_odmor integer not null,
|
---|
40 | v_aktiven smallint not null,
|
---|
41 | f_id integer not null references Firmi(f_id)
|
---|
42 | );
|
---|
43 |
|
---|
44 | create table Otsustva(
|
---|
45 | o_id serial primary key not null,
|
---|
46 | o_datum date not null,
|
---|
47 | o_casovi integer not null,
|
---|
48 | o_opis varchar(100),
|
---|
49 | v_id integer not null references Vraboteni(v_id),
|
---|
50 | vid_id integer not null references Vidovi(vid_id)
|
---|
51 | );
|
---|
52 |
|
---|
53 | create table Vraboten_vo_oddel(
|
---|
54 | vraboten_od DATE DEFAULT CURRENT_DATE,
|
---|
55 | vraboten_do date,
|
---|
56 | v_id integer not null references Vraboteni(v_id),
|
---|
57 | oddel_id integer not null references Oddeli(oddel_id),
|
---|
58 | constraint pk_id primary key(vraboten_od, v_id, oddel_id)
|
---|
59 | ); |
---|