Import Into mySQL

You can easily upload our CSV files into a mySQL database. For a tutorial which runs less then 60 seconds please review this link: https://youtu.be/W76U5c81Cco

Code which you can modify to upload into your mySQL database is found below:

CREATE TABLE STOCK.STOCK_SAMPLE (
TICKER VARCHAR(5),
SAMPLE_DATE VARCHAR(20),
OPEN_PRICE VARCHAR(20),
CLOSE_PRICE VARCHAR(20),
INTRADAY_HIGH VARCHAR(20),
INTRADAY_LOW VARCHAR(20),
DIVIDEND VARCHAR(20));

LOAD DATA INFILE “stock_sample.csv”
INTO TABLE STOCK.STOCK_SAMPLE
COLUMNS TERMINATED BY ‘,’
OPTIONALLY ENCLOSED BY ‘”‘
ESCAPED BY ‘”‘
LINES TERMINATED BY ‘\n’
IGNORE 1 LINES;

SELECT * FROM STOCK.STOCK_SAMPLE;

%d bloggers like this: