-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathschema.sql
34 lines (25 loc) · 1.19 KB
/
schema.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
DROP DATABASE IF EXISTS restaurants;
CREATE DATABASE restaurants;
--createdb
\c restaurants;
--psql database
CREATE TABLE restaurantreview (
id SERIAL PRIMARY KEY,
name VARCHAR(100) NOT NULL,
type VARCHAR(50) NOT NULL,
price VARCHAR(5) NOT NULL,
location VARCHAR(100) NOT NULL,
description VARCHAR(100) NOT NULL,
foodscore VARCHAR(10) NOT NULL,
decorscore VARCHAR(10) NOT NULL,
servicescore VARCHAR(50) NOT NULL,
review TEXT NOT NULL
);
--serial is for postgres, while auto_increment is for mysql
-- INSERT INTO restaurants (name, type, price, location, description, foodScore, decorScore, serviceScore, review) VALUES ?
\timing
-- COPY restaurantreview (name, type, price, location, description, foodscore, decorscore, servicescore, review) FROM '/Users/ivanlee/hrsf117/LeZagat/zagat-reviews/data.csv' DELIMITER ',' CSV;
scp -i forDB.pem /Users/ivanlee/hrsf117/LeZagat/zagat-reviews/data.csv.gz [email protected]:/home/ec2-user
\copy restaurantreview (name,type,price,location,description,foodscore,descorscore,servicescore,review) from "/home/ec2-user/data.csv" delimiter ",", csv;
[ec2-user@ip-172-31-31-140 ~]$ sudo su - postgres
-bash-4.2$ psql -U postgres