-
Notifications
You must be signed in to change notification settings - Fork 81
/
SQL_CREATE_TABLE.sql
62 lines (54 loc) · 1.44 KB
/
SQL_CREATE_TABLE.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
62
DROP DATABASE IF EXISTS englishvalidation;
CREATE DATABASE englishvalidation COLLATE 'utf8_general_ci';
USE englishvalidation;
CREATE TABLE USER (
EMAIL varchar(50) not null,
NAME varchar(50) not null,
SURNAME varchar(50) not null,
SEX char not null,
PASSWORD varchar(50) not null,
USER_TYPE tinyint(1) not null,
primary key (EMAIL)
);
CREATE TABLE SYSTEM_ATTRIBUTE (
SLUG varchar(50) not null,
VALUE varchar(100) not null,
FK_USER varchar(50) not null,
primary key (SLUG),
foreign key (FK_USER) references USER(EMAIL)
);
CREATE TABLE REQUEST (
ID_REQUEST int(20) not null AUTO_INCREMENT,
CERTIFICATE_SERIAL VARCHAR(50) not null,
LEVEL varchar(7) not null,
RELEASE_DATE date not null,
EXPIRY_DATE date not null,
YEAR year not null,
REQUESTED_CFU tinyint(2) not null,
SERIAL int(10) not null,
VALIDATED_CFU tinyint(2) not null,
FK_USER varchar(50) not null,
FK_CERTIFIER int(20) not null,
FK_STATE int(20) not null,
primary key(ID_REQUEST)
);
CREATE TABLE ATTACHED (
ID_ATTACHED int(20) not null AUTO_INCREMENT,
FILENAME varchar(50) not null,
FK_REQUEST int(20) not null,
FK_USER varchar(50) not null,
primary key(ID_ATTACHED)
);
CREATE TABLE ENTE (
ID_ENTE int(20) not null AUTO_INCREMENT,
EMAIL varchar(50) not null,
NAME varchar(100) not null,
SITE varchar(50) not null,
STATO TINYINT not null DEFAULT 0,
primary key (ID_ENTE)
);
CREATE TABLE STATE (
ID_STATE int(20) not null AUTO_INCREMENT,
DESCRIPTION varchar(100) not null,
primary key (ID_STATE)
);