--
-- Database: `patstat`
--
-- BY JULIO RAFFO (EPFL/CEMI)
--
-- Patstat documentation info:

-- [mysqlimport]
-- verbose
-- local=1
-- ignore-lines=1
-- fields-terminated-by=","
-- fields-optionally-enclosed-by='"'
-- fields-escaped-by="\"
-- lines-terminated-by="\r\n"
-- host="localhost"
-- password=""

-- --------------------------------------------------------

--
-- Uploading `tls201_appln`
-- ok (but 2 rows less)

LOAD DATA INFILE 'patstat/raw/tls201_part1.txt' INTO TABLE patstat.tls201_appln
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
IGNORE 1 LINES ;

LOAD DATA INFILE 'patstat/raw/tls201_part2.txt' INTO TABLE patstat.tls201_appln
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
IGNORE 1 LINES ;

LOAD DATA INFILE 'patstat/raw/tls201_part3.txt' INTO TABLE patstat.tls201_appln
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
IGNORE 1 LINES ;

-- --------------------------------------------------------

--
-- Uploading `tls202_title`
-- ok, but 13 rows less

LOAD DATA INFILE 'patstat/raw/tls202_part1.txt' INTO TABLE patstat.tls202_appln_title
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
lines terminated by '\r\n'
IGNORE 1 LINES ;

LOAD DATA INFILE 'patstat/raw/tls202_part2.txt' INTO TABLE patstat.tls202_appln_title
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
lines terminated by '\r\n'
IGNORE 1 LINES ;

LOAD DATA INFILE 'patstat/raw/tls202_part3.txt' INTO TABLE patstat.tls202_appln_title
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
lines terminated by '\r\n'
IGNORE 1 LINES ;

LOAD DATA INFILE 'patstat/raw/tls202_part4.txt' INTO TABLE patstat.tls202_appln_title
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
lines terminated by '\r\n'
IGNORE 1 LINES ;

LOAD DATA INFILE 'patstat/raw/tls202_part5.txt' INTO TABLE patstat.tls202_appln_title
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
lines terminated by '\r\n'
IGNORE 1 LINES ;

-- --------------------------------------------------------

--
-- Uploading `tls203_appln_abstr`
-- ok, but 89 rows less (after taking out primary key, due double ids)


LOAD DATA INFILE 'patstat/raw/tls203_part1.txt' INTO TABLE patstat.tls203_appln_abstr
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
lines terminated by '\r\n'
IGNORE 1 LINES ;

LOAD DATA INFILE 'patstat/raw/tls203_part2.txt' INTO TABLE patstat.tls203_appln_abstr
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
lines terminated by '\r\n'
IGNORE 1 LINES ;

LOAD DATA INFILE 'patstat/raw/tls203_part3.txt' INTO TABLE patstat.tls203_appln_abstr
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
lines terminated by '\r\n'
IGNORE 1 LINES ;

LOAD DATA INFILE 'patstat/raw/tls203_part4.txt' INTO TABLE patstat.tls203_appln_abstr
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
lines terminated by '\r\n'
IGNORE 1 LINES ;

LOAD DATA INFILE 'patstat/raw/tls203_part5.txt' INTO TABLE patstat.tls203_appln_abstr
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
lines terminated by '\r\n'
IGNORE 1 LINES ;

LOAD DATA INFILE 'patstat/raw/tls203_part6.txt' INTO TABLE patstat.tls203_appln_abstr
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
lines terminated by '\r\n'
IGNORE 1 LINES ;

LOAD DATA INFILE 'patstat/raw/tls203_part7.txt' INTO TABLE patstat.tls203_appln_abstr
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
lines terminated by '\r\n'
IGNORE 1 LINES ;

LOAD DATA INFILE 'patstat/raw/tls203_part8.txt' INTO TABLE patstat.tls203_appln_abstr
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
lines terminated by '\r\n'
IGNORE 1 LINES ;

LOAD DATA INFILE 'patstat/raw/tls203_part9.txt' INTO TABLE patstat.tls203_appln_abstr
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
lines terminated by '\r\n'
IGNORE 1 LINES ;


-- --------------------------------------------------------

--
-- Uploading `tls204_appln_prior`
-- ok

LOAD DATA INFILE 'patstat/raw/tls204_part1.txt' INTO TABLE patstat.tls204_appln_prior
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
IGNORE 1 LINES ;

-- --------------------------------------------------------

--
-- Uploading `tls205_tech_rel`
-- ok

LOAD DATA INFILE 'patstat/raw/tls205_part1.txt' INTO TABLE patstat.tls205_tech_rel
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
IGNORE 1 LINES ;

-- --------------------------------------------------------

--
-- Uploading `tls206_person`
-- ok, but 10 rows less

LOAD DATA INFILE 'patstat/raw/tls206_part1.txt' INTO TABLE patstat.tls206_person
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
lines terminated by '\r\n'
IGNORE 1 LINES ;

LOAD DATA INFILE 'patstat/raw/tls206_part2.txt' INTO TABLE patstat.tls206_person
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
lines terminated by '\r\n'
IGNORE 1 LINES ;

LOAD DATA INFILE 'patstat/raw/tls206_part3.txt' INTO TABLE patstat.tls206_person
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
lines terminated by '\r\n'
IGNORE 1 LINES ;

LOAD DATA INFILE 'patstat/raw/tls206_part4.txt' INTO TABLE patstat.tls206_person
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
lines terminated by '\r\n'
IGNORE 1 LINES ;

-- --------------------------------------------------------

--
-- Uploading `tls207_pers_appln`
-- ok (but 2 rows less)

LOAD DATA INFILE 'patstat/raw/tls207_part1.txt' INTO TABLE patstat.tls207_pers_appln
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
IGNORE 1 LINES ;

LOAD DATA INFILE 'patstat/raw/tls207_part2.txt' INTO TABLE patstat.tls207_pers_appln
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
IGNORE 1 LINES ;

LOAD DATA INFILE 'patstat/raw/tls207_part3.txt' INTO TABLE patstat.tls207_pers_appln
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
IGNORE 1 LINES ;

LOAD DATA INFILE 'patstat/raw/tls207_part4.txt' INTO TABLE patstat.tls207_pers_appln
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
IGNORE 1 LINES ;

-- --------------------------------------------------------

--
-- Uploading `tls208_doc_std_nms`
-- ok

LOAD DATA INFILE 'patstat/raw/tls208_part1.txt' INTO TABLE patstat.tls208_doc_std_nms
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
lines terminated by '\r\n'
IGNORE 1 LINES ;

-- --------------------------------------------------------

--
-- Uploading `tls209_appln_ipc`
-- ok (but 4 rows less)

LOAD DATA INFILE 'patstat/raw/tls209_part1.txt' INTO TABLE patstat.tls209_appln_ipc
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
lines terminated by '\r\n'
IGNORE 1 LINES ;

LOAD DATA INFILE 'patstat/raw/tls209_part2.txt' INTO TABLE patstat.tls209_appln_ipc
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
lines terminated by '\r\n'
IGNORE 1 LINES ;

LOAD DATA INFILE 'patstat/raw/tls209_part3.txt' INTO TABLE patstat.tls209_appln_ipc
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
lines terminated by '\r\n'
IGNORE 1 LINES ;

LOAD DATA INFILE 'patstat/raw/tls209_part4.txt' INTO TABLE patstat.tls209_appln_ipc
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
lines terminated by '\r\n'
IGNORE 1 LINES ;

LOAD DATA INFILE 'patstat/raw/tls209_part5.txt' INTO TABLE patstat.tls209_appln_ipc
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
lines terminated by '\r\n'
IGNORE 1 LINES ;

LOAD DATA INFILE 'patstat/raw/tls209_part6.txt' INTO TABLE patstat.tls209_appln_ipc
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
lines terminated by '\r\n'
IGNORE 1 LINES ;

LOAD DATA INFILE 'patstat/raw/tls209_part7.txt' INTO TABLE patstat.tls209_appln_ipc
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
lines terminated by '\r\n'
IGNORE 1 LINES ;

LOAD DATA INFILE 'patstat/raw/tls209_part8.txt' INTO TABLE patstat.tls209_appln_ipc
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
lines terminated by '\r\n'
IGNORE 1 LINES ;

LOAD DATA INFILE 'patstat/raw/tls209_part9.txt' INTO TABLE patstat.tls209_appln_ipc
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
lines terminated by '\r\n'
IGNORE 1 LINES ;

-- --------------------------------------------------------

--
-- Uploading `tls210_appln_n_cls`
-- ok

LOAD DATA INFILE 'patstat/raw/tls210_part1.txt' INTO TABLE patstat.tls210_appln_n_cls
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
lines terminated by '\r\n'
IGNORE 1 LINES ;


-- --------------------------------------------------------

--
-- Uploading `tls211_pat_publn`
-- ok (but 2 rows less)

LOAD DATA INFILE 'patstat/raw/tls211_part1.txt' INTO TABLE patstat.tls211_pat_publn
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
lines terminated by '\r\n'
IGNORE 1 LINES ;

LOAD DATA INFILE 'patstat/raw/tls211_part2.txt' INTO TABLE patstat.tls211_pat_publn
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
lines terminated by '\r\n'
IGNORE 1 LINES ;

LOAD DATA INFILE 'patstat/raw/tls211_part3.txt' INTO TABLE patstat.tls211_pat_publn
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
lines terminated by '\r\n'
IGNORE 1 LINES ;


-- --------------------------------------------------------

--
-- Uploading `tls212_citation`
-- ok (but 4 rows less)

LOAD DATA INFILE 'patstat/raw/tls212_part1.txt' INTO TABLE patstat.tls212_citation
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
lines terminated by '\r\n'
IGNORE 1 LINES ;

LOAD DATA INFILE 'patstat/raw/tls212_part2.txt' INTO TABLE patstat.tls212_citation
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
lines terminated by '\r\n'
IGNORE 1 LINES ;

LOAD DATA INFILE 'patstat/raw/tls212_part3.txt' INTO TABLE patstat.tls212_citation
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
lines terminated by '\r\n'
IGNORE 1 LINES ;

LOAD DATA INFILE 'patstat/raw/tls212_part4.txt' INTO TABLE patstat.tls212_citation
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
lines terminated by '\r\n'
IGNORE 1 LINES ;

LOAD DATA INFILE 'patstat/raw/tls212_part5.txt' INTO TABLE patstat.tls212_citation
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
lines terminated by '\r\n'
IGNORE 1 LINES ;

-- --------------------------------------------------------

--
-- Uploading `tls214_npl_publn`
-- ok (but 1 rows less)

LOAD DATA INFILE 'patstat/raw/tls214_part1.txt' INTO TABLE patstat.tls214_npl_publn
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
lines terminated by '\r\n'
IGNORE 1 LINES ;

-- --------------------------------------------------------

--
-- Uploading `tls215_citn_categ`
-- ok (but 7 rows less)

LOAD DATA INFILE 'patstat/raw/tls215_part1.txt' INTO TABLE patstat.tls215_citn_categ
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
lines terminated by '\r\n'
IGNORE 1 LINES ;

-- --------------------------------------------------------

--
-- Uploading `tls216_appln_contn`
-- ok

LOAD DATA INFILE 'patstat/raw/tls216_part1.txt' INTO TABLE patstat.tls216_appln_contn
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
lines terminated by '\r\n'
IGNORE 1 LINES ;