透過Python來匯入1107_20120102.csv到stock的資料表中,使用下面SQL的語法來達成匯入資料的作業:
"LOAD DATA LOCAL INFILE 'F:\\stock_database\\sale_otc1\\20120102\\1107_20120102.csv' \
INTO TABLE stock CHARACTER SET 'utf8'\
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '\"' \
LINES TERMINATED BY '\\r\\n' \
IGNORE 1 LINES (saledate, stockkind, stockid ,openprice, highprice, lowprice, lastprice, brokerid, price, buyvol, sellvol);"
匯入結果如下圖:
匯入結果如下圖:
沒有留言:
張貼留言