-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDDL(DataDefinitionLanguage).sql
84 lines (76 loc) · 1.76 KB
/
DDL(DataDefinitionLanguage).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
80
81
82
83
84
USE DATABASE wcd_lab;
CREATE SCHEMA IF NOT EXISTS sakila_bi;
CREATE OR REPLACE TABLE sakila_bi.customer_dim (
customer_id int,
first_name varchar(45),
last_name varchar(45),
email varchar(500),
create_date timestamp,
address varchar(500),
address2 varchar(500),
district varchar(20),
city_name varchar(50),
postal_code varchar(10),
phone varchar(20),
coutry_name varchar(50),
active boolean);
CREATE OR REPLACE TABLE sakila_bi.staff_dim (
staff_id int,
first_name varchar(45),
last_name varchar(45),
address varchar(500),
address2 varchar(500),
picture varchar(200),
email varchar(500),
username varchar(500),
password varchar(500),
district varchar(20),
city_name varchar(50),
postal_code varchar(10),
phone varchar(20),
country_name varchar(50),
active boolean);
CREATE OR REPLACE TABLE sakila_bi.store_dim (
store_id int,
manager_firstname varchar(45),
manager_lastname varchar(45),
address varchar(500),
address2 varchar(500),
district varchar(20),
city_name varchar(50),
postal_code varchar(10),
phone varchar(20),
country_name varchar(50));
CREATE OR REPLACE TABLE sakila_bi.film_dim (
film_id int,
title varchar(500),
description TEXT,
released_year int,
language varchar(20),
original_language varchar(20),
rental_duration int,
rental_rate NUMERIC,
length int,
replace_cost NUMERIC,
rating varchar(100),
special_features varchar(100),
actor_first_name varchar(45),
actor_last_name varchar(45),
category_name varchar(45));
CREATE OR REPLACE TABLE sakila_bi.calendar_dim (
cal_dt date,
day_of_wk_num int,
day_of_wk_desc varchar(30),
yr_num integer,
wk_num integer,
yr_wk_num integer,
mnth_num integer,
yr_mnth_num integer);
CREATE OR REPLACE TABLE sakila_bi.TRANSACTION (
trans_dt date,
customer_id int,
staff_id int,
store_id int,
film_id int,
amount NUMERIC,
is_decline boolean);