-
Notifications
You must be signed in to change notification settings - Fork 0
/
src_tables_ddl.sql
123 lines (105 loc) · 3.16 KB
/
src_tables_ddl.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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
CREATE TABLE sa_olist_dataset.src_seller
(SELLER_ID_SRC varchar (255),
SELLER_TELEPHONE_NUM varchar (255),
SELLER_EMAIL varchar (255));
COMMIT;
-- DROP TABLE sa_olist_dataset.src_seller;
CREATE TABLE sa_olist_dataset.src_customer
(customer_unique_id varchar (255),
customer_first_name varchar (255),
customer_last_name varchar (255),
customer_telephone_num varchar (255),
customer_email varchar (255));
COMMIT;
-- DROP TABLE sa_olist_dataset.src_customer;
CREATE TABLE sa_olist_dataset.src_country
(country_id varchar (255),
country_name varchar (255),
country_abbrev varchar (255),
geolocation_emerg_id varchar (255));
COMMIT;
-- DROP TABLE sa_olist_dataset.src_country;
CREATE TABLE sa_olist_dataset.src_cities
(geolocation_city varchar (255),
geolocation_state varchar (255)
);
COMMIT;
CREATE TABLE sa_olist_dataset.src_regions
(geolocation_state varchar (255),
geolocation_country_name varchar (255),
geolocation_emerg_id varchar (255)
);
COMMIT;
CREATE TABLE sa_olist_dataset.src_geolocation
(geolocation_country_id varchar (255),
geolocation_country_name varchar (255),
geolocation_zip_code_prefix varchar (255),
geolocation_lat varchar (255),
geolocation_lng varchar (255),
geolocation_city varchar (255)
);
COMMIT;
-- DROP TABLE sa_olist_dataset.src_geolocation;
CREATE TABLE sa_generated_dataset.src_employees
(employee_id varchar (255),
employee_first_name varchar (255),
employee_last_name varchar (255),
employee_telephone_num varchar (255),
employee_position_name varchar (255));
COMMIT;
CREATE TABLE sa_generated_dataset.src_stores
(store_id varchar (255),
store_name varchar (255),
tel_num varchar (255),
location_id varchar(255));
COMMIT;
-- DROP TABLE sa_generated_dataset.src_stores;
CREATE TABLE sa_olist_dataset.src_product
(product_id varchar (255),
product_name varchar (255),
product_category_name varchar (255),
product_weight_g varchar (255),
product_length_cm varchar (255),
product_height_cm varchar (255),
product_width_cm varchar (255)
);
COMMIT;
-- DROP TABLE sa_olist_dataset.src_product;
CREATE TABLE sa_olist_dataset.src_order_item
(order_id varchar (255),
order_item_id varchar (255),
product_id varchar (255),
seller_id varchar (255),
shipping_limit_date varchar (255),
price varchar(255),
geolocation_lat varchar (255),
geolocation_lng varchar (255),
store_id varchar (255),
employee_id varchar (255),
customer_id varchar (255),
customer_unique_id varchar (255),
order_purchase_timestamp varchar (255)
);
CREATE TABLE sa_olist_dataset.src_order_customer
(
order_id varchar (255),
customer_id varchar (255),
order_status varchar (255),
order_purchase_timestamp varchar (255),
order_approved_at varchar (255),
order_delivered_carrier_date varchar (255),
order_delivered_customer_date varchar (255),
order_estimated_delivery_date varchar (255)
);
CREATE TABLE sa_olist_dataset.src_order_payment
(
order_id varchar (255),
payment_sequential varchar (255),
payment_type varchar (255),
payment_installments varchar (255),
payment_value varchar (255)
);
CREATE TABLE sa_olist_dataset.src_customer_unique
(customer_id varchar (255),
customer_unique_id varchar (255)
);