-
Notifications
You must be signed in to change notification settings - Fork 0
/
sql_Table.txt
80 lines (74 loc) · 2.49 KB
/
sql_Table.txt
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
80
SQL TABLE DESIGN
******************************************
Staging_events :
event_id - BIGINT IDENTITY(0,1) NOT NULL
artist - VARCHAR
auth - VARCHAR
firstName - VARCHAR
gender - CHAR(1)
itemInSession - INTEGER NOT NULL
lastName - VARCHAR
length - FLOAT
level - VARCHAR
location - VARCHAR
method - VARCHAR
page - VARCHAR
registration - FLOAT
sessionId - INTEGER SORTKEY DISTKEY
song - VARCHAR
status - VARCHAR NOT NULL
ts - TIMESTAMP
userAgent - VARCHAR
userId - INTEGER
******************************************
staging_songs :
num_songs - INTEGER
artist_id - VARCHAR NOT NULL SORTKEY DISTKEY
artist_latitude - FLOAT
artist_location - VARCHAR
artist_longitude - FLOAT
artist_name - VARCHAR
duration - FLOAT
song_id - VARCHAR NOT NULL
title - VARCHAR
year - INTEGER
******************************************
Fact Table : fact_songplay
songplay_id - INTEGER IDENTITY(0,1) PRIMARY KEY
start_time - TIMESTAMP SORTKEY
user_id - INTEGER DISTKEY
level - VARCHAR
song_id - VARCHAR
artist_id - VARCHAR
session_id - INTEGER
location - VARCHAR
user_agent - VARCHAR
******************************************
Dimesion Tables :
1) users : dim_user
user_id - INTEGER PRIMARY KEY DISTKEY SORTKEY
first_name - VARCHAR
last_name - VARCHAR
gender - CHAR(1)
level - VARCHAR
2) songs : dim_song
song_id - VARCHAR PRIMARY KEY SORTKEY
title - VARCHAR
artist_id - VARCHAR
year - INTEGER
duration - FLOAT
3) artists : dim_artist
artist_id - VARCHAR PRIMARY KEY SORTKEY
name - VARCHAR
location - VARCHAR
latitude - FLOAT
longitude - FLOAT
4) time : dim_time
start_time - TIMESTAMP PRIMARY KEY SORTKEY
hour - INTEGER
day - INTEGER
week - INTEGER
month - INTEGER
year - INTEGER
weekday - INTEGER
******************************************