-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCREATE_DB.sql
61 lines (53 loc) · 1.26 KB
/
CREATE_DB.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
CREATE DATABASE notenverwaltungssystem;
CREATE TABLE adresse (
adresseId int auto_increment PRIMARY KEY,
strasse text,
nummer text
);
CREATE TABLE ort (
ortId int auto_increment PRIMARY KEY,
plz int,
ort text
);
CREATE TABLE klasse (
klasseId int auto_increment PRIMARY KEY,
name text
);
CREATE TABLE modul (
modulId int auto_increment PRIMARY KEY,
name text,
beschreibung text,
typ text
);
CREATE TABLE schueler (
schuelerId int auto_increment PRIMARY KEY,
vorname text,
name text,
fkAdresseId int,
FOREIGN KEY (fkAdresseId) REFERENCES adresse(adresseId),
fkOrtId int,
FOREIGN KEY (fkOrtId) REFERENCES ort(ortId),
fkKlasseId int,
FOREIGN KEY (fkKlasseId) REFERENCES klasse(klasseId)
);
CREATE TABLE pruefung (
pruefungId int auto_increment PRIMARY KEY,
name text,
fkModulId int,
FOREIGN KEY(fkModulId) REFERENCES modul(modulId),
fkSchuelerId int,
FOREIGN KEY(fkSchuelerId) REFERENCES schueler(schuelerId),
note DOUBLE,
gewichtung int
);
CREATE TABLE rolle (
rolleId int auto_increment PRIMARY KEY,
rolle text
);
CREATE TABLE user (
userId int auto_increment PRIMARY KEY,
name text,
passwort text,
fkRolleId int,
FOREIGN KEY(fkRolleId) REFERENCES rolle(rolleId)
);