-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpopulate-AmazonDB.sql
78 lines (67 loc) · 3.42 KB
/
populate-AmazonDB.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
#use the Amazon-like database created
use amazondb;
#drop warehouses table if exists,create a table like it, and load into it the warehouses data from file
#data is separated by commas and each row data is in a line of the file (a field's data might be enclosed in "'s)
drop table if exists warehouses;
create table warehouses like warehouses_table;
load data local infile 'C:\\Users\\AnaMarta\\Documents\\UCF\\Spring 2013\\Database Systems\\AmazonDB- Folder\\warehouse.txt'
into table warehouses
fields terminated by ','
lines terminated by '\r\n';
#show the populated table
select * from warehouses;
#drop products table if exists,create a table like it, and load into it the products data from file
#data is separated by commas and each row data is in a line of the file (a field's data might be enclosed in "'s)
drop table if exists products;
create table products like products_table;
load data local infile 'C:\\Users\\AnaMarta\\Documents\\UCF\\Spring 2013\\Database Systems\\AmazonDB- Folder\\products.txt'
into table products
fields terminated by ','
optionally enclosed by '"'
lines terminated by '\r\n';
#show the populated table
select * from products;
#drop customers table if exists,create a table like it, and load into it the customer data from file
#data is separated by commas and each row data is in a line of the file (a field's data might be enclosed in "'s)
drop table if exists customers;
create table customers like customers_table;
load data local infile 'C:\\Users\\AnaMarta\\Documents\\UCF\\Spring 2013\\Database Systems\\AmazonDB- Folder\\customers.txt'
into table customers
fields terminated by ','
optionally enclosed by '"'
lines terminated by '\r\n';
#show the populated table
select * from customers;
#drop orders table if exists,create a table like it, and load into it the orders data from file
#data is separated by commas and each row data is in a line of the file (a field's data might be enclosed in "'s)
drop table if exists orders;
create table orders like orders_table;
load data local infile 'C:\\Users\\AnaMarta\\Documents\\UCF\\Spring 2013\\Database Systems\\AmazonDB- Folder\\orders.txt'
into table orders
fields terminated by ','
optionally enclosed by '"'
lines terminated by '\r\n';
#show the populated table
select * from orders;
#drop order lines table if exists,create a table like it, and load into it the order lines data from file
#data is separated by commas and each row data is in a line of the file (a field's data might be enclosed in "'s)
drop table if exists order_lines;
create table order_lines like order_lines_table;
load data local infile 'C:\\Users\\AnaMarta\\Documents\\UCF\\Spring 2013\\Database Systems\\AmazonDB- Folder\\order_lines.txt'
into table order_lines
fields terminated by ','
optionally enclosed by '"'
lines terminated by '\r\n';
#show the populated table
select * from order_lines;
#drop shipments table if exists,create a table like it, and load into it the shipments data from file
#data is separated by commas and each row data is in a line of the file (a field's data might be enclosed in "'s)
drop table if exists shipments;
create table shipments like shipments_table;
load data local infile 'C:\\Users\\AnaMarta\\Documents\\UCF\\Spring 2013\\Database Systems\\AmazonDB- Folder\\shipment.txt'
into table shipments
fields terminated by ','
optionally enclosed by '"'
lines terminated by '\r\n';
#show the populated table
select * from shipments;