-
Notifications
You must be signed in to change notification settings - Fork 0
/
SQL Files.sql
60 lines (45 loc) · 1.34 KB
/
SQL Files.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
/* Benjamin Weymouth
POSTGRE SQL Example */
DROP TABLE IF EXISTS card_holder;
CREATE TABLE card_holder(
id SERIAL PRIMARY KEY,
name VARCHAR(30) NOT NULL
);
/* Importing the CSV File from local machine */
COPY card_holder
FROM 'C:\postgreSQLdata\card_holder.csv'
DELIMITER ','
CSV HEADER;
/* check that the import worked */
select * from card_holder;
/* creating credit_card table*/
DROP TABLE IF EXISTS credit_card;
CREATE TABLE credit_card(
card VARCHAR(30) PRIMARY KEY NOT NULL,
cardholder_id int NOT NULL
);
/* Importing the CSV File from local machine */
-- step 1: utilize PgAdmin wizard to import the csv
-- step 2: check that the import worked
select * from credit_card;
/* check that the import worked */
select * from card_holder;
/* creating merchant_category table*/
DROP TABLE IF EXISTS merchant_category;
CREATE TABLE merchant_category(
id SERIAL PRIMARY KEY NOT NULL,
name VARCHAR(30) NOT NULL
);
-- step 1: utilize PgAdmin wizard to import the csv
-- step 2: check that the import worked
select * from merchant_category;
/* creating merchant table*/
DROP TABLE IF EXISTS merchant;
CREATE TABLE merchant(
id SERIAL PRIMARY KEY NOT NULL,
name VARCHAR(50) NOT NULL,
id_merchant_category int NOT NULL
);
-- step 1: utilize PgAdmin wizard to import the csv
-- step 2: check that the import worked
select * from merchant;