-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmyclass.sql
60 lines (53 loc) · 1.62 KB
/
myclass.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
create database db_myclass;
use db_myclass;
create table usuario (
idUsuario int not null auto_increment primary key,
nome varchar(60) not null,
email varchar (60) not null,
senha char(8)
);
create table sala (
idSala int not null auto_increment primary key,
apelido varchar(60) not null unique,
faculdade varchar(70) not null,
curso varchar(70) not null,
ano char(4) not null,
turno char(5) not null,
periodo varchar(8) not null,
senha char(8)
);
create table criaSala (
idCriaSala int not null auto_increment Primary key,
idUsuario int not null,
idSala int not null,
FOREIGN KEY (idUsuario) REFERENCES usuario(idUsuario),
FOREIGN KEY (idSala) REFERENCES sala(idSala)
);
create table evento (
idEvento int not null auto_increment primary key,
nomeEvento varchar(60) not null,
data date not null,
idSala int not null,
FOREIGN KEY (idSala) REFERENCES sala(idSala)
);
create table criaEvento (
idCriaEvento int not null auto_increment primary key,
idUsuario int not null,
idEvento int not null,
FOREIGN KEY (idUsuario) REFERENCES usuario(idUsuario),
FOREIGN KEY (idEvento) REFERENCES evento(idEvento)
);
create table material (
idMaterial int not null auto_increment primary key,
horarioPostagem time not null,
nome char(60) not null,
OBS varchar(600) not null,
caminho char(100) not null
);
create table possuiMaterial (
idPossuiMaterial int not null auto_increment primary key,
idEvento int not null,
idMaterial int not null,
FOREIGN KEY (idEvento) REFERENCES evento(idEvento),
FOREIGN KEY (idMaterial) REFERENCES material(idMaterial)
);