-
Notifications
You must be signed in to change notification settings - Fork 1
/
schema.sql
43 lines (36 loc) · 1.01 KB
/
schema.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
-- Name characters: 50
CREATE TABLE Prof_M (
id BIGSERIAL PRIMARY KEY,
first_name VARCHAR(50) NOT NULL,
last_name VARCHAR(50) NOT NULL
);
CREATE TABLE Time_Block_M (
name CHAR(1) PRIMARY KEY,
start_time VARCHAR(25) NOT NULL,
end_time VARCHAR(25) NOT NULL
);
CREATE TABLE Course_Section_S (
section SMALLINT PRIMARY KEY,
professor BIGINT REFERENCES Prof_M,
course_name VARCHAR(4) NOT NULL,
course_number SMALLINT NOT NULL,
time_block CHAR(1) NOT NULL REFERENCES Time_Block_M,
seat_cap SMALLINT,
section_title VARCHAR(50)
);
CREATE TABLE Room_M (
id SERIAL PRIMARY KEY,
building VARCHAR(50) NOT NULL,
room_num SMALLINT NOT NULL,
feature_score INT -- Size of this field depends on # of entries in Room_Feature_M
);
CREATE TABLE Room_Feature_M (
id SERIAL PRIMARY KEY,
description_str VARCHAR(50) NOT NULL
);
CREATE TYPE PREF AS ENUM ( 'cannot', 'dislike', 'ok', 'like' );
CREATE TABLE Room_Prefs_S (
section_num SMALLINT REFERENCES Course_Section_S,
room_id INT REFERENCES Room_M,
preference PREF NOT NULL
);