我有这个文本文件,它只是一个我从excel复制/粘贴到记事本的列。我需要将这个长列添加到MySQl表中。
我应该这样:
但我最终得到了那个东西:
+----------+-----------+-----------+----------------------------------------+
| col1 | start | end | sv_id |
+----------+-----------+-----------+----------------------------------------+
|19697691 | 119698417 | 1
|402_Chr1 | 119733151 | 119926178 | 2
|403_Chr1 | 119748355 | 119941691 | 3
|21014665 | 121015358 | 4
|22795978 | 122800912 | 5
|22932211 | 122938556 | 6
|23058013 | 123059350 | 7
|23099162 | 123107650 | 8
|23380132 | 123380895 | 9
|23673831 | 123678274 | 10
|411_Chr1 | 124033638 | 124035798 | 11
|412_Chr1 | 124033644 | 124035811 | 12
这是我的代码:
mysql> show create table list;
list | CREATE TABLE `list` (
`chr` varchar(255) DEFAULT NULL,
`start` bigint(20) DEFAULT NULL,
`end` bigint(20) DEFAULT NULL,
ENGINE=InnoDB DEFAULT CHARSET=utf8 |
mysql> load data local infile 'C:/DB/SV/data/test.txt' into table list;
Query OK, 2401 rows affected, 4275 warnings (0.05 sec)
Records: 2401 Deleted: 0 Skipped: 0 Warnings: 0
mysql> delete from list where sv_id=0;
Query OK, 2201 rows affected (0.05 sec)
哦,不要介意sv_id列我将其更改为自动递增..无论如何,这里的问题是弄清楚我的test.txt文件和col1的内容。