-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchallenge_db_create.sql
More file actions
48 lines (42 loc) · 2.13 KB
/
Copy pathchallenge_db_create.sql
File metadata and controls
48 lines (42 loc) · 2.13 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
# -*- coding: utf-8 -*-
"""
Created on Wed Aug 11 12:50:03 2021
"""
CREATE TABLE IF NOT EXISTS conversions (
conv_id text NOT NULL,
user_id text NOT NULL,
conv_date text NOT NULL,
conv_time text NOT NULL,
revenue real NOT NULL,
PRIMARY KEY(conv_id)
);
CREATE TABLE IF NOT EXISTS session_costs (
session_id text NOT NULL,
cost real,
PRIMARY KEY(session_id)
);
CREATE TABLE IF NOT EXISTS session_sources (
session_id text NOT NULL,
user_id text NOT NULL,
event_date text NOT NULL,
event_time text NOT NULL,
channel_name text NOT NULL,
holder_engagement INTEGER NOT NULL,
closer_engagement INTEGER NOT NULL,
impression_interaction INTEGER NOT NULL,
PRIMARY KEY(session_id)
);
CREATE TABLE IF NOT EXISTS attribution_customer_journey (
conv_id text NOT NULL,
session_id text NOT NULL,
ihc real NOT NULL,
PRIMARY KEY(conv_id,session_id)
);
CREATE TABLE IF NOT EXISTS channel_reporting (
channel_name text NOT NULL,
date text NOT NULL,
cost real NOT NULL,
ihc real NOT NULL,
ihc_revenue real NOT NULL,
PRIMARY KEY(channel_name,date)
);