-
Notifications
You must be signed in to change notification settings - Fork 0
/
scriptPATU.sql
36 lines (33 loc) · 921 Bytes
/
scriptPATU.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
CREATE TABLE Professor(
nif VARCHAR (8) PRIMARY KEY,
nom VARCHAR (30) NOT NULL,
cognoms VARCHAR (50) NOT NULL,
correu_upv VARCHAR (25) NOT NULL
);
CREATE TABLE AlumneTutor(
nif VARCHAR (8) PRIMARY KEY,
nom VARCHAR (30) NOT NULL,
cognoms VARCHAR (50) NOT NULL,
correu_upv VARCHAR (25) NOT NULL
);
CREATE TABLE Tutelat(
nif VARCHAR (8) PRIMARY KEY,
nom VARCHAR (30) NOT NULL,
cognoms VARCHAR (50) NOT NULL,
correu_upv VARCHAR (25) NOT NULL,
correu_personal VARCHAR (25) NOT NULL,
grup_patu VARCHAR (3),
grup_matricula VARCHAR (6),
mobil VARCHAR (9),
FOREIGN KEY (grup_patu) references Grups(grup)
);
CREATE TABLE Grup(
grup VARCHAR(3),
professor VARCHAR(8),
alumne1 VARCHAR(8),
alumne2 VARCHAR(8),
PRIMARY KEY (grup, professor, alumne1),
FOREIGN KEY (professor) references Professors(nif),
FOREIGN KEY (alumne1) references Tutors(nif),
FOREIGN KEY (alumne2) references Tutors(nif)
);