forked from scottbromander/express_passport_lecture_start
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathqueries.sql
More file actions
35 lines (27 loc) · 1.02 KB
/
queries.sql
File metadata and controls
35 lines (27 loc) · 1.02 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
CREATE TABLE auth0user (
id SERIAL PRIMARY KEY,
auth0_user_id VARCHAR(255) UNIQUE
);
CREATE TABLE birthinfo (
id SERIAL PRIMARY KEY,
day INT NOT NULL,
month INT NOT NULL,
year INT NOT NULL,
hour INT NOT NULL,
minute INT NOT NULL,
latitude REAL NOT NULL,
longitude REAL NOT NULL,
user_id INT REFERENCES auth0user
);
CREATE TABLE match (
id SERIAL PRIMARY KEY,
user_id INT REFERENCES auth0user,
match_percent DECIMAL(3,2),
match_text TEXT,
match_name VARCHAR (50)
);
INSERT INTO auth0user(auth0_user_id) VALUES (11111111111);
INSERT INTO birthinfo(date_time, latitude, longitude, user_id) VALUES ('2016-08-12 10:22:31.949271z', 32.2133546, -10.2255, 1);
INSERT INTO match(match_name, match_percent, match_text, user_id) VALUES ('Bob', .64, 'some astrology text', 1);
INSERT INTO match(match_name, match_percent, match_text, user_id) VALUES ('Phil', .63, 'some other astrology text', 1);
SELECT * from auth0user JOIN match on (auth0user.id = match.user_id) where auth0_user_id = 11111111111;