メモです。
データをローカルファイルからインポートしようとしたところ、
Warningsが表示されていました。
なぜ発生したか調べる場合、コマンドの実行直後に「SHOW WARNINGS;」を
発行するとWarningの内容が表示されるとのこと。
実行した結果は以下の通りです。
mysql> LOAD DATA LOCAL INFILE "/usr/local/src/Yuubin/zipcode.csv" INTO TABLE jpzipcode FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\n'; Query OK, 123006 rows affected, 65535 warnings (0.45 sec) Records: 123006 Deleted: 0 Skipped: 0 Warnings: 123006 mysql> SHOW WARNINGS; +---------+------+----------------------------------------------------------------------------+ | Level | Code | Message | +---------+------+----------------------------------------------------------------------------+ | Warning | 1262 | Row 1 was truncated; it contained more data than there were input columns | | Warning | 1262 | Row 2 was truncated; it contained more data than there were input columns | | Warning | 1262 | Row 3 was truncated; it contained more data than there were input columns | | Warning | 1262 | Row 4 was truncated; it contained more data than there were input columns | | Warning | 1262 | Row 5 was truncated; it contained more data than there were input columns | | Warning | 1262 | Row 6 was truncated; it contained more data than there were input columns | +---------+------+----------------------------------------------------------------------------+ 64 rows in set (0.00 sec)
※ちなみにこのメッセージが出たのは、インポート対象のカラムが文字通り足りなかったせいでした。
今日はこんな所で。