String interception:
SELECT SUBSTRING (' ABCDEFG ', 2,5)
To calculate the character length:
Len (String)
--Inquiry 2010 Pre-admission Idselect user from Cf_log where substr (user,0,4) <2010 order by user ASC limit 0, 10;
Number of statistics tuples:
Select COUNT (*) from Cf_user;
Query repeat:
Select count (user), user,pwd,name from Cf_user Group by user have count (user) >1;
the query results are inserted into the table:
INSERT INTO Cf_grade1 select * from Cf_grade where user= "order by term;
Insert into Cf_user (user,pwd,name,degree,dept,major,class,year) SELECT distinct User,pwd,name,degree,dept,major, Class,year from Cf_log;
Insert into Ims_goods_3 (model,name,price) Select Model,name,price from Ims_goods_5 order by model;
Go Weight:
Delete from table where ID not in (the Select Max (ID) from table group by repeating column);
Time Stamp Conversion Week:
DAYOFWEEK () Sunday: 1, Monday: 2 .....
--Query Sunday record SELECT * from D where DAYOFWEEK (From_unixtime (time) = 1;
Get current time:
Select LocalTime (); select now ();--current_timestamp (), same effect
Get YYYY-MM-DD Date
Select Curdate ();--2015-09-06
Dynamic Time:
Sysdate ()
Month Day Conversion:
Set @dt = Now (); Select DayOfWeek (@dt); --1select DayOfMonth (@dt); --6select DayOfYear (@dt); --249 Returns the number of days of the current year
Query the date of the last day of the specified month:
Select Last_day (now ()); -2015-09-30
Two date time difference [return int type]:
If the first parameter is less than the second argument returns a negative number
Select DateDiff (now (), ' 2015-08-28 ');
MySQL time conversion/string intercept/