【MySQL】CSVファイルをインポートするコマンド

  • 102
    Like
  • 0
    Comment
More than 1 year has passed since last update.
# TERMINATED BY 区切り文字
# ENCLOSED BY 囲み文字
LOAD DATA LOCAL INFILE '/tmp/import.csv' INTO TABLE table_name FIELDS TERMINATED BY ',' ENCLOSED BY '"'
# データを入れるカラムを指定
LOAD DATA LOCAL INFILE '/tmp/import.csv' INTO TABLE table_name FIELDS TERMINATED BY ',' ENCLOSED BY '"' (column1, column2)