-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathschema_pre.sql
More file actions
64 lines (58 loc) · 1.62 KB
/
schema_pre.sql
File metadata and controls
64 lines (58 loc) · 1.62 KB
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
63
-- schema_pre.sql: Pre-population schema without constraints
CREATE TABLE business (
business_id TEXT, -- will be converted to PK
name TEXT,
address TEXT,
city TEXT,
state TEXT,
postal_code TEXT,
latitude FLOAT,
longitude FLOAT,
stars FLOAT,
review_count INTEGER,
is_open INTEGER, -- will be converted to boolean
attributes JSONB,
categories TEXT[],
hours JSONB,
business_account_id INTEGER -- will be converted to nullable fk
);
CREATE TABLE review (
review_id TEXT, -- will be converted to PK
user_id TEXT,
business_id TEXT,
stars INTEGER,
useful INTEGER,
funny INTEGER,
cool INTEGER,
text TEXT,
date DATE -- YYYY-MM-DD
);
CREATE TABLE yelp_user (
user_id TEXT, -- will be converted to pk
name TEXT,
yelping_since DATE, -- YYYY-MM-DD
useful INTEGER,
funny INTEGER,
cool INTEGER,
compliment_useful INTEGER, -- renamed, data from compliment_writer
compliment_cool INTEGER,
compliment_funny INTEGER,
average_stars FLOAT,
review_count INTEGER,
username TEXT,
password TEXT
);
CREATE TABLE tip (
user_id TEXT, -- will be converted to fk
business_id TEXT, -- will be converted to fk
text TEXT,
date DATE, -- YYYY-MM-DD
praise_count INTEGER -- renamed, data from compliment_count
);
CREATE TABLE business_account (
account_id INTEGER, -- will be converted to AUTO INT PK
username TEXT,
password TEXT,
name TEXT,
business_count INTEGER
);