-
Notifications
You must be signed in to change notification settings - Fork 1
/
inserting_records.sql
62 lines (53 loc) · 1.47 KB
/
inserting_records.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
load data infile '/states.csv'
into table states
fields terminated by ','
lines terminated by '\r\n'
(state);
load data infile '/sectors.csv'
into table sectors
fields terminated by ','
optionally enclosed by '"'
lines terminated by '\r\n'
(sector);
load data infile '/revenues.csv'
into table revenues
fields terminated by ','
optionally enclosed by '"'
lines terminated by '\r\n'
(revenue);
load data infile '/sizes.csv'
into table sizes
fields terminated by ','
optionally enclosed by '"'
lines terminated by '\r\n'
(size);
load data infile '/skills.csv'
into table skills
fields terminated by ','
optionally enclosed by '"'
lines terminated by '\r\n'
(skill);
load data infile '/industries.csv'
into table industries
fields terminated by ','
optionally enclosed by '"'
lines terminated by '\r\n'
(industry, sectorID);
load data infile '/companies.csv'
into table companies
fields terminated by ','
optionally enclosed by '"'
lines terminated by '\r\n'
(companyName, sizeID, revenueID, industryID, @rating)
SET rating = IF(char_length(trim(@rating)) = 0, NULL, @rating);
load data infile '/jobpostings.csv'
into table jobpostings
fields terminated by ','
optionally enclosed by '"'
lines terminated by '\r\n'
(title, companyID, lower_salary, upper_salary, job_description, city, stateID);
load data infile '/jobpostings_skills.csv'
into table jobpostings_skills
fields terminated by ','
lines terminated by '\r\n'
(jobpostingID, skillID, companyID);