-
Notifications
You must be signed in to change notification settings - Fork 0
/
create_tables.sql
79 lines (73 loc) · 1.71 KB
/
create_tables.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
CREATE TABLE public.artists (
artist_id VARCHAR(19),
name VARCHAR(256),
location VARCHAR(256),
latitude FLOAT4,
longitude FLOAT4
);
CREATE TABLE public.songplays (
songplay_id varchar(32) NOT NULL,
start_time TIMESTAMP,
user_id INT,
level VARCHAR(4),
song_id VARCHAR(19),
artist_id VARCHAR(19),
session_id INTEGER,
location VARCHAR(256),
user_agent VARCHAR(512)
);
CREATE TABLE public.songs (
song_id VARCHAR(19),
title VARCHAR(256),
artist_id VARCHAR(19),
year SMALLINT,
duration FLOAT8
);
CREATE TABLE public.staging_events (
artist VARCHAR(256),
auth VARCHAR(20),
firstName VARCHAR(256),
gender CHAR(1),
itemInSession INTEGER,
lastName VARCHAR(256),
length FLOAT,
level VARCHAR(10),
location VARCHAR(256),
method VARCHAR(10),
page VARCHAR(50),
registration BIGINT,
sessionId INTEGER,
song VARCHAR(256),
status INTEGER,
ts BIGINT,
userAgent VARCHAR(512),
userId INT
);
CREATE TABLE public.staging_songs (
artist_id VARCHAR(19),
artist_latitude FLOAT,
artist_location VARCHAR(256),
artist_longitude FLOAT,
artist_name VARCHAR(256),
duration FLOAT,
num_songs INTEGER,
song_id VARCHAR(19),
title VARCHAR(256),
year INTEGER
);
CREATE TABLE public.times (
start_time TIMESTAMP sortkey,
hour SMALLINT,
day SMALLINT,
week SMALLINT,
month SMALLINT,
year SMALLINT,
weekday SMALLINT
);
CREATE TABLE users (
user_id INTEGER,
first_name VARCHAR(20),
last_name VARCHAR(15),
gender CHAR(1),
level VARCHAR(4)
);