Load dataThe usage is as follows:
Load data [LOW_PRIORITY | CONCURRENT] [LOCAL] INFILE 'file_name.txt'
[REPLACE | IGNORE]
INTO TABLE Tbl_name
[FIELDS//Field
[Terminated by 'string']//FieldRoomDelimiter
[[OPTIONALLY] enclosed by 'Char ']//Including the field symbol
[Escaped by 'Char ']//FieldEscape Character
]
[LINES
[Starting by 'string']//Start string of the row
[Terminated by 'string']//LineEnd splitCharacterNo.
]
[IGNORE Number LINES]//Skip the previous stepNumberLine
[(Col_name_or_user_var,...)] //Field name
[SET Col_name = Expr,...)]
For example, a data text is as follows:
Stock CodeStock nameKickoffClosing Price
Def: "000001 ","Deep DevelopmentA "," 13.24 "," 13.56"
Def: "000002 ","VankeA "," 24.43 "," 24.77"
Load data local infile 'table_name.txt'
Into table database_name
Fields terminated by ', 'enabledby' "'escaped '\'
Lines starting by 'def'
IGNORE 1 LINES
(Stock_code, stock_name, opening, settlement );
Let's take a look at my actual operations:
If you log on to the remote mysql server and want to import your local text to the database, local is required. The commands are different.
Load data local infile '/usr/local/mysql/var/Statistic/Spam.txt' into table Spam;