· 5 years ago · Mar 25, 2020, 10:42 AM
1DROP TABLE IF EXISTS corsi;
2CREATE TABLE corsi (
3 corso_id integer primary key auto_increment not null,
4 tipo integer not null,
5 tipologia integer not null,
6 descrizione varchar(100) not null,
7 edizione varchar(100) not null,
8 previsto integer not null,
9 erogato integer not null,
10 durata integer not null,
11 misura integer not null,
12 note varchar(100) not null,
13 luogo varchar(100) not null,
14 ente varchar(100) not null,
15 data_erogazione date not null,
16 data_chiusura date not null,
17 data_censimento date not null,
18 interno integer not null,
19 FOREIGN KEY (tipo) REFERENCES tipi(tipo_id),
20 FOREIGN KEY (tipologia) REFERENCES tipologie(tipologia_id),
21 FOREIGN KEY (misura) REFERENCES misure(misura_id)
22);
23
24DROP TABLE IF EXISTS corsi_docenti;
25CREATE TABLE corsi_docenti(
26 corsi_docenti_id integer not null primary key auto_increment,
27 corso integer not null,
28 docente integer not null,
29 interno integer not null,
30 FOREIGN KEY (corso) REFERENCES corsi(corso_id)
31);
32
33DROP TABLE IF EXISTS corsi_utenti;
34CREATE TABLE corsi_utenti(
35 corsi_utenti_id integer not null primary key auto_increment,
36 corso integer not null,
37 dipendente integer not null,
38 durata integer not null,
39 FOREIGN KEY (corso) REFERENCES corsi(corso_id),
40 FOREIGN KEY (dipendente) REFERENCES dipendenti(dipendente_id)
41);