テキストファイルからデータをインポート
mysql> select * from tb1n;
+------+------+------+
| bang | nama | tosi |
+------+------+------+
| A101 | 佐藤 | 40 |
| A102 | 高橋 | 28 |
| A103 | 中川 | 20 |
| A104 | 渡辺 | 23 |
| A105 | 西沢 | 35 |
+------+------+------+
5 rows in set (0.01 sec)
インポートするテキストファイル(t.csv)
c:/data/t.csv
N551,佐々木,37
N552,伊藤,41
N553,斉藤,31
N554,井上,43
N555,阿部,31
mysql> load data infile 'c:/data/t.csv' into table tb1n
-> fields terminated by ',';
Query OK, 5 rows affected (0.07 sec)
Records: 5 Deleted: 0 Skipped: 0 Warnings: 0
mysql> select * from tb1n;
+------+--------+------+
| bang | nama | tosi |
+------+--------+------+
| A101 | 佐藤 | 40 |
| A102 | 高橋 | 28 |
| A103 | 中川 | 20 |
| A104 | 渡辺 | 23 |
| A105 | 西沢 | 35 |
| N551 | 佐々木 | 37 |
| N552 | 伊藤 | 41 |
| N553 | 斉藤 | 31 |
| N554 | 井上 | 43 |
| N555 | 阿部 | 31 |
+------+--------+------+
10 rows in set (0.03 sec)
mysql> select * from tb1n;
+------+------+------+
| bang | nama | tosi |
+------+------+------+
| A101 | 佐藤 | 40 |
| A102 | 高橋 | 28 |
| A103 | 中川 | 20 |
| A104 | 渡辺 | 23 |
| A105 | 西沢 | 35 |
+------+------+------+
5 rows in set (0.01 sec)
インポートするテキストファイル(t.csv)
c:/data/t.csv
N551,佐々木,37
N552,伊藤,41
N553,斉藤,31
N554,井上,43
N555,阿部,31
mysql> load data infile 'c:/data/t.csv' into table tb1n
-> fields terminated by ',';
Query OK, 5 rows affected (0.07 sec)
Records: 5 Deleted: 0 Skipped: 0 Warnings: 0
mysql> select * from tb1n;
+------+--------+------+
| bang | nama | tosi |
+------+--------+------+
| A101 | 佐藤 | 40 |
| A102 | 高橋 | 28 |
| A103 | 中川 | 20 |
| A104 | 渡辺 | 23 |
| A105 | 西沢 | 35 |
| N551 | 佐々木 | 37 |
| N552 | 伊藤 | 41 |
| N553 | 斉藤 | 31 |
| N554 | 井上 | 43 |
| N555 | 阿部 | 31 |
+------+--------+------+
10 rows in set (0.03 sec)
※コメント投稿者のブログIDはブログ作成者のみに通知されます