mysql load data 语法

mysql> load data local infile "d:/gpsdata.txt" into table positiondata fields terminated by ';'  (userid,latitude,longitude,altitude,speed,innerid,repo
rttime,status); 

 

 

 

LOAD DATA [LOW_PRIORITY CONCURRENT] [LOCAL] INFILE ’file_name.txt’
    [REPLACE IGNORE]
    INTO TABLE tbl_name
    [FIELDS
        [TERMINATED BY ’string’]
        [[OPTIONALLY] ENCLOSED BY ’char’]
        [ESCAPED BY ’char’ ]
    ]
    [LINES
        [STARTING BY ’string’]
        [TERMINATED BY ’string’]
    ]
    [IGNORE number LINES]
    [(col_name_or_user_var,...)]
    [SET col_name = eXPr,...)]

fields和lines在前面,(col_name_or_user_var,…)在后面 如果你使用的时候直接把要写的这些属性放在表名后面,这样是不正确的,一定要写到fields和lines的后面!

你可能感兴趣的:(mysql load data 语法)