-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsql_syntax
36 lines (31 loc) · 869 Bytes
/
sql_syntax
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 user(
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
username varchar(50),
role enum('superuser','user')
);
CREATE TABLE groups(
groupID INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
groupName varchar(50)
);
CREATE TABLE subGroups(
subgroupID INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
groupID INT NOT NULL,
subgroupName VARCHAR(50),
FOREIGN KEY (groupID) REFERENCES groups(groupID)
);
CREATE TABLE userInSubgroup(
id INT NOT NULL,
groupID INT NOT NULL,
FOREIGN KEY (id) REFERENCES user(id),
FOREIGN KEY (groupID) REFERENCES subGroups(subgroupID)
);
CREATE TABLE encoding(
faceID INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
subgroupID INT NOT NULL,
faceOwner VARCHAR(50),
encodingblob BLOB NOT NULL,
FOREIGN KEY (subgroupID) REFERENCES subGroups(subgroupID)
);
CREATE TABLE images(
faceOwner VARCHAR(200),
path VARCHAR(200));