SQL import txt and SQL time format operations
Load data local infile "path name" into table "table name"
For example, if the specific location of my file is "f: \ dataset \ beijing \ xx.txt" and the name of the created table is "person", the specific expression of the preceding command is:
load data local infile "f:\\dataset\\beijing\\xx.txt" into table person;
If your txt data contains multiple rows, the interval between fields in each row is comma (",").
You need to specify a comma (,) as shown in.
View the read data, as shown in.
See, a total of 18 data records are read, the same as files in txt.
Date formatting in MySQL
Common string formatting:
Year
The year in the format of % Y.
The year in double-digit % y format.
As shown in, get the current system time and format it. When the input value is % Y, the four-digit time is 2015. When the input is % y, the two-digit time is 15.
Month
% M double-digit month (, 02, 03, ·, 12)
% C indicates the month (1, 2, 3, ·, 12)
% B abbreviated month (Jan, Feb, ·, Dec)
% M month name (January, February,..., December)
As shown in. When % y-% M is entered, 12-January is displayed (two years, month name, with '-' as the separator ). When % m is entered, it is displayed as a two-digit month. When % c is entered, it is displayed as a number (one or two digits ). The abbreviated month is displayed when you enter % B.
Days
% D double-digit days (, ·, 31)
% E number of days (1, 2,..., 31)
As shown in. When % EIS entered, it is displayed as a number. When % d is entered, the number of days in two digits is displayed.
Time
% L hour in numeric format, 12 hours (, 3, ·, 12)
% K, 24 hours (, 2,..., 23)
% H two-digit hour, 24 hours
% H two-digit hour, 12 hours
% I, % I two-digit score (, ·, 59)
% S, % s second (, 02, ·, 59)
% P AM (AM), PM (PM)
As shown in.
-------------------------------------- Split line --------------------------------------
Install MySQL in Ubuntu 14.04
MySQL authoritative guide (original book version 2nd) Clear Chinese scan PDF
Ubuntu 14.04 LTS install LNMP Nginx \ PHP5 (PHP-FPM) \ MySQL
Build a MySQL Master/Slave server in Ubuntu 14.04
Build a highly available distributed MySQL cluster using Ubuntu 12.04 LTS
Install MySQL5.6 and Python-MySQLdb in the source code of Ubuntu 12.04
MySQL-5.5.38 universal binary Installation
-------------------------------------- Split line --------------------------------------
This article permanently updates the link address: