-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathschema 3.sql
More file actions
93 lines (71 loc) · 2.16 KB
/
Copy pathschema 3.sql
File metadata and controls
93 lines (71 loc) · 2.16 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
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
DROP DATABASE IF EXISTS etsySeller;
CREATE DATABASE etsySeller;
USE etsySeller;
CREATE TABLE sellers (
id int AUTO_INCREMENT NOT NULL PRIMARY KEY,
first_name varchar(99) NOT NULL,
last_name varchar(99) NOT NULL,
seller_image varchar(255),
store_id int
);
CREATE TABLE stores (
id int AUTO_INCREMENT NOT NULL PRIMARY KEY,
store_name varchar(255) NOT NULL,
sales int,
year_started int(4),
based_in varchar(100),
store_image varchar(255)
);
CREATE TABLE products (
id int AUTO_INCREMENT NOT NULL PRIMARY KEY,
product_name varchar(255) NOT NULL,
product_price decimal(5, 2) NOT NULL,
is_free_shipping tinyint(1) NOT NULL,
product_image varchar(255) NOT NULL,
store_id int NOT NULL
);
/* POSTGRESSQL
CREATE TABLE sellers (
id SERIAL,
first_name varchar(99),
last_name varchar(99),
seller_image varchar(255),
store_id int,
PRIMARY KEY (id)
);
CREATE TABLE stores (
id SERIAL,
store_name varchar(255),
sales int,
year_started int,
based_in varchar(100),
store_image varchar(255),
PRIMARY KEY (id)
);
CREATE TABLE products (
id SERIAL,
product_name varchar(255),
product_price decimal(5, 2),
is_free_shipping int,
product_image varchar(255),
store_id int,
PRIMARY KEY (id)
);
*/
/*
COPY sellers(id,first_name,last_name,seller_image,store_id)
FROM '/Users/eno/Desktop/SDC/Etsy-SellerDescription/sellers.csv'
DELIMITER ','
CSV HEADER;
COPY stores(id,store_name,sales,year_started,based_in,store_image)
FROM '/Users/eno/Desktop/SDC/Etsy-SellerDescription/stores.csv'
DELIMITER ','
CSV HEADER;
COPY products(id,product_name,product_price,is_free_shipping,product_image,store_id)
FROM '/Users/eno/Desktop/SDC/Etsy-SellerDescription/products.csv'
DELIMITER ','
CSV HEADER;
\copy sellers(id,first_name,last_name,seller_image,store_id) FROM '/home/ec2-user/SellerDescription/sellers.csv' DELIMITER ',' CSV HEADER;
\copy products(id,product_name,product_price,is_free_shipping,product_image,store_id) FROM '/home/ec2-user/SellerDescription/products.csv' DELIMITER ',' CSV HEADER;
\copy stores(id,store_name,sales,year_started,based_in,store_image) FROM '/home/ec2-user/SellerDescription/stores.csv' DELIMITER ',' CSV HEADER;
*/