-
Notifications
You must be signed in to change notification settings - Fork 0
/
02_import_data_files.sql
368 lines (308 loc) · 11.3 KB
/
02_import_data_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
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
--- IMPORT UNZIPPED DATA FILES ---
-- cdanne@diw-econ.de
-- 2023-10-10
--- CHANGE DB ---
USE patstat2023a;
--- CREATE TABLES ---
SET autocommit=0;
SET unique_checks = 0;
SET foreign_key_checks = 0;
--- tbl201 ---
LOAD DATA LOCAL INFILE '<SET PATH TO DATA FOLDER>/tls201_part01.csv'
INTO TABLE tls201_appln
FIELDS TERMINATED BY ','
ENCLOSED BY '"' LINES TERMINATED BY '\r\n'
IGNORE 1 LINES;
LOAD DATA LOCAL INFILE '<SET PATH TO DATA FOLDER>/tls201_part02.csv'
INTO TABLE tls201_appln
FIELDS TERMINATED BY ','
ENCLOSED BY '"' LINES TERMINATED BY '\r\n'
IGNORE 1 LINES;
LOAD DATA LOCAL INFILE '<SET PATH TO DATA FOLDER>/tls201_part03.csv'
INTO TABLE tls201_appln
FIELDS TERMINATED BY ','
ENCLOSED BY '"' LINES TERMINATED BY '\r\n'
IGNORE 1 LINES;
--- tbl 202 ---
LOAD DATA LOCAL INFILE '<SET PATH TO DATA FOLDER>/tls202_part01.csv'
INTO TABLE tls202_appln_title
FIELDS TERMINATED BY ','
ENCLOSED BY '"' LINES TERMINATED BY '\r\n'
IGNORE 1 LINES;
-- --- tbl 203 --- skipped due to size
-- LOAD DATA LOCAL INFILE '<SET PATH TO DATA FOLDER>/tls203_part01.csv'
-- INTO TABLE tls203_appln_abstr
-- FIELDS TERMINATED BY ','
-- ENCLOSED BY '"' LINES TERMINATED BY '\r\n'
-- IGNORE 1 LINES;
--- tbl 204 ---
LOAD DATA LOCAL INFILE '<SET PATH TO DATA FOLDER>/tls204_part01.csv'
INTO TABLE tls204_appln_prior
FIELDS TERMINATED BY ','
ENCLOSED BY '"' LINES TERMINATED BY '\r\n'
IGNORE 1 LINES;
--- tbl 205 ---
LOAD DATA LOCAL INFILE '<SET PATH TO DATA FOLDER>/tls205_part01.csv'
INTO TABLE tls205_tech_rel
FIELDS TERMINATED BY ','
ENCLOSED BY '"' LINES TERMINATED BY '\r\n'
IGNORE 1 LINES;
--- tbl 206 ---
LOAD DATA LOCAL INFILE '<SET PATH TO DATA FOLDER>/tls206_part01.csv'
INTO TABLE tls206_person
FIELDS TERMINATED BY ','
ENCLOSED BY '"' LINES TERMINATED BY '\r\n'
IGNORE 1 LINES;
--- tbl 207 ---
LOAD DATA LOCAL INFILE '<SET PATH TO DATA FOLDER>/tls207_part01.csv'
INTO TABLE tls207_pers_appln
FIELDS TERMINATED BY ','
ENCLOSED BY '"' LINES TERMINATED BY '\r\n'
IGNORE 1 LINES;
--- tbl 209 ---
LOAD DATA LOCAL INFILE '<SET PATH TO DATA FOLDER>/tls209_part01.csv'
INTO TABLE tls209_appln_ipc
FIELDS TERMINATED BY ','
ENCLOSED BY '"' LINES TERMINATED BY '\r\n'
IGNORE 1 LINES;
LOAD DATA LOCAL INFILE '<SET PATH TO DATA FOLDER>/tls207_part02.csv'
INTO TABLE tls209_appln_ipc
FIELDS TERMINATED BY ','
ENCLOSED BY '"' LINES TERMINATED BY '\r\n'
IGNORE 1 LINES;
LOAD DATA LOCAL INFILE '<SET PATH TO DATA FOLDER>/tls207_part03.csv'
INTO TABLE tls209_appln_ipc
FIELDS TERMINATED BY ','
ENCLOSED BY '"' LINES TERMINATED BY '\r\n'
IGNORE 1 LINES;
--- tbl 210 ---
LOAD DATA LOCAL INFILE '<SET PATH TO DATA FOLDER>/tls210_part01.csv'
INTO TABLE tls210_appln_n_cls
FIELDS TERMINATED BY ','
ENCLOSED BY '"' LINES TERMINATED BY '\r\n'
IGNORE 1 LINES;
--- tbl 211 ---
LOAD DATA LOCAL INFILE '<SET PATH TO DATA FOLDER>/tls211_part01.csv'
INTO TABLE tls211_pat_publn
FIELDS TERMINATED BY ','
ENCLOSED BY '"' LINES TERMINATED BY '\r\n'
IGNORE 1 LINES;
LOAD DATA LOCAL INFILE '<SET PATH TO DATA FOLDER>/tls211_part02.csv'
INTO TABLE tls211_pat_publn
FIELDS TERMINATED BY ','
ENCLOSED BY '"' LINES TERMINATED BY '\r\n'
IGNORE 1 LINES;
--- tbl 212 ---
LOAD DATA LOCAL INFILE '<SET PATH TO DATA FOLDER>/tls212_part01.csv'
INTO TABLE tls212_citation
FIELDS TERMINATED BY ','
ENCLOSED BY '"' LINES TERMINATED BY '\r\n'
IGNORE 1 LINES;
LOAD DATA LOCAL INFILE '<SET PATH TO DATA FOLDER>/tls212_part02.csv'
INTO TABLE tls212_citation
FIELDS TERMINATED BY ','
ENCLOSED BY '"' LINES TERMINATED BY '\r\n'
IGNORE 1 LINES;
LOAD DATA LOCAL INFILE '<SET PATH TO DATA FOLDER>/tls212_part03.csv'
INTO TABLE tls212_citation
FIELDS TERMINATED BY ','
ENCLOSED BY '"' LINES TERMINATED BY '\r\n'
IGNORE 1 LINES;
--- tbl 214 ---
LOAD DATA LOCAL INFILE '<SET PATH TO DATA FOLDER>/tls214_part01.csv'
INTO TABLE patstat2023a.tls214_npl_publn
FIELDS TERMINATED BY ','
ENCLOSED BY '"' LINES TERMINATED BY '\r\n'
IGNORE 1 LINES ;
--- tbl 215 ---
LOAD DATA LOCAL INFILE '<SET PATH TO DATA FOLDER>/tls215_part01.csv'
INTO TABLE tls215_citn_categ
FIELDS TERMINATED BY ','
ENCLOSED BY '"' LINES TERMINATED BY '\r\n'
IGNORE 1 LINES;
LOAD DATA LOCAL INFILE '<SET PATH TO DATA FOLDER>/tls215_part02.csv'
INTO TABLE tls215_citn_categ
FIELDS TERMINATED BY ','
ENCLOSED BY '"' LINES TERMINATED BY '\r\n'
IGNORE 1 LINES;
LOAD DATA LOCAL INFILE '<SET PATH TO DATA FOLDER>/tls215_part03.csv'
INTO TABLE tls215_citn_categ
FIELDS TERMINATED BY ','
ENCLOSED BY '"' LINES TERMINATED BY '\r\n'
IGNORE 1 LINES;
--- tbl 216 ---
LOAD DATA LOCAL INFILE '<SET PATH TO DATA FOLDER>/tls216_part01.csv'
INTO TABLE tls216_appln_contn
FIELDS TERMINATED BY ','
ENCLOSED BY '"' LINES TERMINATED BY '\r\n'
IGNORE 1 LINES;
--- tbl 222 ---
LOAD DATA LOCAL INFILE '<SET PATH TO DATA FOLDER>/tls222_part01.csv'
INTO TABLE tls222_appln_jp_class
FIELDS TERMINATED BY ','
ENCLOSED BY '"' LINES TERMINATED BY '\r\n'
IGNORE 1 LINES;
LOAD DATA LOCAL INFILE '<SET PATH TO DATA FOLDER>/tls222_part02.csv'
INTO TABLE tls222_appln_jp_class
FIELDS TERMINATED BY ','
ENCLOSED BY '"' LINES TERMINATED BY '\r\n'
IGNORE 1 LINES;
--- tbl 224 ---
LOAD DATA LOCAL INFILE '<SET PATH TO DATA FOLDER>/tls224_part01.csv'
INTO TABLE tls224_appln_cpc
FIELDS TERMINATED BY ','
ENCLOSED BY '"' LINES TERMINATED BY '\r\n'
IGNORE 1 LINES;
LOAD DATA LOCAL INFILE '<SET PATH TO DATA FOLDER>/tls224_part02.csv'
INTO TABLE tls224_appln_cpc
FIELDS TERMINATED BY ','
ENCLOSED BY '"' LINES TERMINATED BY '\r\n'
IGNORE 1 LINES;
LOAD DATA LOCAL INFILE '<SET PATH TO DATA FOLDER>/tls224_part03.csv'
INTO TABLE tls224_appln_cpc
FIELDS TERMINATED BY ','
ENCLOSED BY '"' LINES TERMINATED BY '\r\n'
IGNORE 1 LINES;
--- tbl 225 ---
LOAD DATA LOCAL INFILE '<SET PATH TO DATA FOLDER>/tls225_part01.csv'
INTO TABLE tls225_docdb_fam_cpc
FIELDS TERMINATED BY ','
ENCLOSED BY '"' LINES TERMINATED BY '\r\n'
IGNORE 1 LINES;
LOAD DATA LOCAL INFILE '<SET PATH TO DATA FOLDER>/tls225_part02.csv'
INTO TABLE tls225_docdb_fam_cpc
FIELDS TERMINATED BY ','
ENCLOSED BY '"' LINES TERMINATED BY '\r\n'
IGNORE 1 LINES;
--- tbl 226 ---
LOAD DATA LOCAL INFILE '<SET PATH TO DATA FOLDER>/tls226_part01.csv'
INTO TABLE tls226_person_orig
FIELDS TERMINATED BY ','
ENCLOSED BY '"' LINES TERMINATED BY '\r\n'
IGNORE 1 LINES;
LOAD DATA LOCAL INFILE '<SET PATH TO DATA FOLDER>/tls226_part02.csv'
INTO TABLE tls226_person_orig
FIELDS TERMINATED BY ','
ENCLOSED BY '"' LINES TERMINATED BY '\r\n'
IGNORE 1 LINES;
--- tbl 227 ---
LOAD DATA LOCAL INFILE '<SET PATH TO DATA FOLDER>/tls227_part01.csv'
INTO TABLE tls227_pers_publn
FIELDS TERMINATED BY ','
ENCLOSED BY '"' LINES TERMINATED BY '\r\n'
IGNORE 1 LINES;
LOAD DATA LOCAL INFILE '<SET PATH TO DATA FOLDER>/tls227_part02.csv'
INTO TABLE tls227_pers_publn
FIELDS TERMINATED BY ','
ENCLOSED BY '"' LINES TERMINATED BY '\r\n'
IGNORE 1 LINES;
--- tbl 228 ---
LOAD DATA LOCAL INFILE '<SET PATH TO DATA FOLDER>/tls228_part01.csv'
INTO TABLE tls228_docdb_fam_citn
FIELDS TERMINATED BY ','
ENCLOSED BY '"' LINES TERMINATED BY '\r\n'
IGNORE 1 LINES;
--- tbl 229 ---
LOAD DATA LOCAL INFILE '<SET PATH TO DATA FOLDER>/tls229_part01.csv'
INTO TABLE tls229_appln_nace2
FIELDS TERMINATED BY ','
ENCLOSED BY '"' LINES TERMINATED BY '\r\n'
IGNORE 1 LINES;
--- tbl 230 ---
LOAD DATA LOCAL INFILE '<SET PATH TO DATA FOLDER>/tls230_part01.csv'
INTO TABLE tls230_appln_techn_field
FIELDS TERMINATED BY ','
ENCLOSED BY '"' LINES TERMINATED BY '\r\n'
IGNORE 1 LINES;
-- --- tbl 231 ---
-- LOAD DATA LOCAL INFILE '<SET PATH TO DATA FOLDER>/tls231_part01.csv'
-- INTO TABLE tls231_inpadoc_legal_event
-- FIELDS TERMINATED BY ','
-- ENCLOSED BY '"' LINES TERMINATED BY '\r\n'
-- IGNORE 1 LINES;
-- LOAD DATA LOCAL INFILE '<SET PATH TO DATA FOLDER>/tls231_part02.csv'
-- INTO TABLE tls231_inpadoc_legal_event
-- FIELDS TERMINATED BY ','
-- ENCLOSED BY '"' LINES TERMINATED BY '\r\n'
-- IGNORE 1 LINES;
-- LOAD DATA LOCAL INFILE '<SET PATH TO DATA FOLDER>/tls231_part03.csv'
-- INTO TABLE tls231_inpadoc_legal_event
-- FIELDS TERMINATED BY ','
-- ENCLOSED BY '"' LINES TERMINATED BY '\r\n'
-- IGNORE 1 LINES;
-- LOAD DATA LOCAL INFILE '<SET PATH TO DATA FOLDER>/tls231_part04.csv'
-- INTO TABLE tls231_inpadoc_legal_event
-- FIELDS TERMINATED BY ','
-- ENCLOSED BY '"' LINES TERMINATED BY '\r\n'
-- IGNORE 1 LINES;
-- LOAD DATA LOCAL INFILE '<SET PATH TO DATA FOLDER>/tls231_part05.csv'
-- INTO TABLE tls231_inpadoc_legal_event
-- FIELDS TERMINATED BY ','
-- ENCLOSED BY '"' LINES TERMINATED BY '\r\n'
-- IGNORE 1 LINES;
-- LOAD DATA LOCAL INFILE '<SET PATH TO DATA FOLDER>/tls231_part06.csv'
-- INTO TABLE tls231_inpadoc_legal_event
-- FIELDS TERMINATED BY ','
-- ENCLOSED BY '"' LINES TERMINATED BY '\r\n'
-- IGNORE 1 LINES;
-- LOAD DATA LOCAL INFILE '<SET PATH TO DATA FOLDER>/tls231_part07.csv'
-- INTO TABLE tls231_inpadoc_legal_event
-- FIELDS TERMINATED BY ','
-- ENCLOSED BY '"' LINES TERMINATED BY '\r\n'
-- IGNORE 1 LINES;
-- LOAD DATA LOCAL INFILE '<SET PATH TO DATA FOLDER>/tls231_part08.csv'
-- INTO TABLE tls231_inpadoc_legal_event
-- FIELDS TERMINATED BY ','
-- ENCLOSED BY '"' LINES TERMINATED BY '\r\n'
-- IGNORE 1 LINES;
-- LOAD DATA LOCAL INFILE '<SET PATH TO DATA FOLDER>/tls231_part09.csv'
-- INTO TABLE tls231_inpadoc_legal_event
-- FIELDS TERMINATED BY ','
-- ENCLOSED BY '"' LINES TERMINATED BY '\r\n'
-- IGNORE 1 LINES;
-- LOAD DATA LOCAL INFILE '<SET PATH TO DATA FOLDER>/tls231_part10.csv'
-- INTO TABLE tls231_inpadoc_legal_event
-- FIELDS TERMINATED BY ','
-- ENCLOSED BY '"' LINES TERMINATED BY '\r\n'
-- IGNORE 1 LINES;
-- LOAD DATA LOCAL INFILE '<SET PATH TO DATA FOLDER>/tls231_part11.csv'
-- INTO TABLE tls231_inpadoc_legal_event
-- FIELDS TERMINATED BY ','
-- ENCLOSED BY '"' LINES TERMINATED BY '\r\n'
-- IGNORE 1 LINES;
-- LOAD DATA LOCAL INFILE '<SET PATH TO DATA FOLDER>/tls231_part12.csv'
-- INTO TABLE tls231_inpadoc_legal_event
-- FIELDS TERMINATED BY ','
-- ENCLOSED BY '"' LINES TERMINATED BY '\r\n'
-- IGNORE 1 LINES;
--- tbl 801 ---
LOAD DATA LOCAL INFILE '<SET PATH TO DATA FOLDER>/tls801_part01.csv'
INTO TABLE tls801_country
FIELDS TERMINATED BY ','
ENCLOSED BY '"' LINES TERMINATED BY '\r\n'
IGNORE 1 LINES;
--- tbl 803 ---
LOAD DATA LOCAL INFILE '<SET PATH TO DATA FOLDER>/tls803_part01.csv'
INTO TABLE tls803_legal_event_code
FIELDS TERMINATED BY ','
ENCLOSED BY '"' LINES TERMINATED BY '\r\n'
IGNORE 1 LINES;
--- tbl 901 ---
LOAD DATA LOCAL INFILE '<SET PATH TO DATA FOLDER>/tls901_part01.csv'
INTO TABLE tls901_techn_field_ipc
FIELDS TERMINATED BY ','
ENCLOSED BY '"' LINES TERMINATED BY '\r\n'
IGNORE 1 LINES;
--- tbl 902 ---
LOAD DATA LOCAL INFILE '<SET PATH TO DATA FOLDER>/tls902_part01.csv'
INTO TABLE tls902_ipc_nace2
FIELDS TERMINATED BY ','
ENCLOSED BY '"' LINES TERMINATED BY '\r\n'
IGNORE 1 LINES;
--- tbl 904 ---
LOAD DATA LOCAL INFILE '<SET PATH TO DATA FOLDER>/tls904_part01.csv'
INTO TABLE tls904_nuts
FIELDS TERMINATED BY ','
ENCLOSED BY '"' LINES TERMINATED BY '\r\n'
IGNORE 1 LINES;
COMMIT;