请耐心等待,因为这将是一封很长的邮件。作为任务的一部分,我正在使用MYSQL 5.6.10构建TAC(手机)数据库。我使用以下SQL命令创建了一个名为TACTest的表:
CREATE TABLE TACTest (TAC VARCHAR(8), Make VARCHAR(384), Manufacturer VARCHAR(128), Band VARCHAR(384);
我通过名为test.txt的文件填充此表,该文件存储在我的C:驱动器上。以下是该文件的内容(6种不同的手机):
TAC|Marketing Name|Manufacturer|Band
00100100|G410|Mitsubishi|GSM 1800,GSM 900
00440227|This is a Test IMEI|(AEB) Armando Este Banquito|GSM 1800,GSM 900
01283200|Bunting Camera – WX292|Jaguariuna - Brazil|GSM 1900,GSM850 (GSM800)
01237100|WX295 – EU (850/1900)|Motorola|GSM 1900,GSM850 (GSM800)
35599803|Nüvifone A50|ASUSTek Computer Inc|GSM 1800,GSM 1900,GSM 900,GSM850 (GSM800)
01273300|"T410/T410i, T410s/T410si,T510/W510/T510i, X201/X201s, X201i/X201si, X201 Tablet, X201i Tablet, X100e, Edge 13"", Edge 14"", Edge 15"" , L512, L412 , Edge 13”, Edge 11”, X120e"|Lenovo Mobile Communication Technology Ltd|GSM 1800,GSM 1900,GSM 900,GSM850 (GSM800)
这是我用来填充表格的SQL:
LOAD DATA LOCAL INFILE 'C:\\test.txt' INTO TABLE TACTest CHARACTER SET utf8 fields terminated by '|' lines terminated by '\n' IGNORE 1 LINES (TAC, Make, Manufacturer, Band);
问题是,插入后,Make和Manufacturer列在数据库中缺少数据。以下是Make和Manufacturer列的数据库中的信息:
Make Manufacturer
G410 Mitsubishi
This is a Test IMEI (AEB)
Bunting Camera Jaguariuna - Brazil
WX295 Motorola
N ASUSTek Computer Inc
"T410/T410i, T410s/T410si,T510/W510/T510i, X201/X201s, X201i/X201si, X201 Tablet, X201i Tablet, X100e, Edge 13"", Edge 14"", Edge 15"" , L512, L412 , Edge 13 Lenovo Mobile Communication Technology Ltd
基本上对于制造商列,第2行有部分信息,对于Make列,第3-6行有部分信息?
我在这里做错了什么?插入特殊字符有什么特别需要做的吗?任何帮助将不胜感激。
答案 0 :(得分:0)
我刚刚运行了您提供的查询,我正在获取正确的数据。唯一的区别在于我的操作系统我相信(我的机器在ubuntu上运行)
mysql> show create table TACTest \G
*************************** 1. row ***************************
Table: TACTest
Create Table: CREATE TABLE `TACTest` (
`TAC` varchar(8) DEFAULT NULL,
`Make` varchar(384) DEFAULT NULL,
`Manufacturer` varchar(128) DEFAULT NULL,
`Band` varchar(384) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
1 row in set (0.00 sec)
mysql> select * from TACTest \G
*************************** 1. row ***************************
TAC: 00100100
Make: G410
Manufacturer: Mitsubishi
Band: GSM 1800,GSM 900
*************************** 2. row ***************************
TAC: 00440227
Make: This is a Test IMEI
Manufacturer: (AEB) Armando Este Banquito
Band: GSM 1800,GSM 900
*************************** 3. row ***************************
TAC: 01283200
Make: Bunting Camera � WX292
Manufacturer: Jaguariuna - Brazil
Band: GSM 1900,GSM850 (GSM800)
*************************** 4. row ***************************
TAC: 01237100
Make: WX295 � EU (850/1900)
Manufacturer: Motorola
Band: GSM 1900,GSM850 (GSM800)
*************************** 5. row ***************************
TAC: 35599803
Make: N�vifone A50
Manufacturer: ASUSTek Computer Inc
Band: GSM 1800,GSM 1900,GSM 900,GSM850 (GSM800)
*************************** 6. row ***************************
TAC: 01273300
Make: "T410/T410i, T410s/T410si,T510/W510/T510i, X201/X201s, X201i/X201si, X201 Tablet, X201i Tablet, X100e, Edge 13"", Edge 14"", Edge 15"" , L512, L412 , Edge 13�, Edge 11�, X120e"
Manufacturer: Lenovo Mobile Communication Technology Ltd
Band: GSM 1800,GSM 1900,GSM 900,GSM850 (GSM800)
6 rows in set (0.00 sec)