-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathcontoso-psql.sql
213 lines (195 loc) · 4.31 KB
/
contoso-psql.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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
CREATE TABLE FactStrategyPlan (
StrategyPlanKey int ,
Datekey timestamp ,
EntityKey int ,
ScenarioKey int,
AccountKey int,
CurrencyKey int,
ProductCategoryKey int,
Amount float,
ETLLoadID int,
LoadDate timestamp ,
UpdateDate timestamp
)
;
\copy FactStrategyPlan FROM '/tmp/data/FactStrategyPlan.csv' DELIMITER ',' CSV HEADER
select * from FactStrategyPlan limit 5;
CREATE TABLE FactSalesQuota (
SalesQuotaKey int ,
ChannelKey int ,
StoreKey int ,
ProductKey int,
DateKey timestamp,
CurrencyKey int,
ScenarioKey int,
SalesQuantityQuota float,
SalesAmountQuota float,
GrossMarginQuota float ,
ETLLoadID int,
LoadDate timestamp,
UpdateDate timestamp
)
;
\copy FactSalesQuota FROM '/tmp/data/FactSalesQuota.csv' DELIMITER ',' CSV HEADER
select * from FactSalesQuota limit 5;
CREATE TABLE FactSales (
SalesKey int ,
DateKey timestamp ,
channelKey int ,
StoreKey int,
ProductKey int,
PromotionKey int,
CurrencyKey int,
UnitCost float,
UnitPrice float,
SalesQuantity int ,
ReturnQuantity int,
ReturnAmount float,
DiscountQuantity int,
DiscountAmount float,
TotalCost float,
SalesAmount float,
ETLLoadID int,
LoadDate timestamp ,
UpdateDate timestamp
)
;
\copy FactSales FROM '/tmp/data/FactSales.csv' DELIMITER ',' CSV HEADER
select * from FactSales limit 5;
CREATE TABLE FactOnlineSales (
OnlineSalesKey int ,
DateKey timestamp ,
StoreKey int ,
ProductKey int,
PromotionKey int,
CurrencyKey int,
CustomerKey int,
SalesOrderNumber varchar,
SalesOrderLineNumber int,
SalesQuantity int ,
SalesAmount float,
ReturnQuantity int,
ReturnAmount float,
DiscountQuantity int,
DiscountAmount float,
TotalCost float,
UnitCost float,
UnitPrice float,
ETLLoadID int,
LoadDate timestamp ,
UpdateDate timestamp
)
;
\copy FactOnlineSales FROM '/tmp/data/FactOnlineSales.csv' DELIMITER ',' CSV HEADER
select * from FactOnlineSales limit 5;
CREATE TABLE FactITSLA (
ITSLAkey int ,
DateKey timestamp ,
StoreKey int ,
MachineKey int,
OutageKey int,
OutageStartTime timestamp,
OutageEndTime timestamp,
DownTime int,
ETLLoadID int,
LoadDate timestamp,
UpdateDate timestamp
)
;
\copy FactITSLA FROM '/tmp/data/FactITSLA.csv' DELIMITER ',' CSV HEADER
select * from FactITSLA limit 5;
CREATE TABLE FactITMachine (
ITMachinekey int ,
MachineKey int,
DateKey timestamp ,
CostAmount float,
CostType varchar,
ETLLoadID int,
LoadDate timestamp,
UpdateDate timestamp
)
;
\copy FactITMachine FROM '/tmp/data/FactITMachine.csv' DELIMITER ',' CSV HEADER
select * from FactITMachine limit 5;
CREATE TABLE FactInventory (
InventoryKey int ,
DateKey timestamp ,
StoreKey int,
ProductKey int,
CurrencyKey int,
OnHandQuantity int ,
OnOrderQuantity int,
SafetyStockQuantity int,
UnitCost float,
DaysInStock int,
MinDayInStock int,
MaxDayInStock int,
Aging int,
ETLLoadID int,
LoadDate timestamp ,
UpdateDate timestamp
)
;
\copy FactInventory FROM '/tmp/data/FactInventory.csv' DELIMITER ',' CSV HEADER
select * from FactInventory limit 5;
CREATE TABLE FactExchangeRate (
ExchangeRateKey int ,
CurrencyKey int,
DateKey timestamp ,
AverageRate float,
EndOfDayRate float,
ETLLoadID int,
LoadDate timestamp ,
UpdateDate timestamp
)
;
\copy FactExchangeRate FROM '/tmp/data/FactExchangeRate.csv' DELIMITER ',' CSV HEADER
select * from FactExchangeRate limit 5;
CREATE TABLE DimStore (
StoreKey int,
GeographyKey int,
StoreManager int,
StoreType varchar,
StoreName varchar,
StoreDescription varchar,
Status varchar,
OpenDate timestamp ,
CloseDate timestamp ,
EntityKey int,
ZipCode varchar,
ZipCodeExtension varchar,
StorePhone varchar,
StoreFax varchar,
CloseReason varchar,
EmployeeCount int,
SellingAreaSize float,
LastRemodelDate timestamp ,
ETLLoadID int,
SomeDate1 timestamp ,
SomeDate2 timestamp ,
LoadDate timestamp ,
UpdateDate timestamp
)
;
\copy DimStore FROM '/tmp/data/DimStore.csv' DELIMITER ',' CSV HEADER
select * from DimStore limit 5;
CREATE TABLE DimSalesTerritory (
SalesTerritoryKey int,
GeographyKey int,
SalesTerritoryLabel varchar,
SalesTerritoryName varchar,
SalesTerritoryRegion varchar,
SalesTerritoryCountry varchar,
SalesTerritoryGroup varchar,
SalesTerritoryLevel varchar,
SalesTerritoryManager int,
StartDate timestamp,
EndDate timestamp,
Status varchar,
ETLLoadID int,
LoadDate timestamp ,
UpdateDate timestamp
)
;
\copy DimSalesTerritory FROM '/tmp/data/DimSalesTerritory.csv' DELIMITER ',' CSV HEADER
select * from DimSalesTerritory limit 5;