String functions
Select concat (' Hello ', ' word ', ' my ') myname; // concat () link character functions output hellowordmy myname is the alias Select lcase (' MYSQL '); //lcase () Convert to lowercase Output mysql select length (' string ') //length () The length of the output string Select ltrim (' strimg '); //ltrim () Remove left space Select rtrim (' string '); //rtrim () Remove Right space select repeat (' PHP, ', 3); //repeat () Repeat output php,php,php,select replace (' Linux is very good ', ' Linux ', ' php ') ; //replace () Replace output php is very goodselect substr (' Linux is very good ', 1,5); The starting position of the  //SUBSTR (),mysql is 1, the output linuxselect space (Ten); //space (); generates 10 spacesMathematical functions
Select bin (192); //bin (); decimal turn binary , Output 11000000select celing (10.1); //celing (); rounding up output 11select floor (10.1); //floor (); down rounding output 10select max (col); // max () Take maximum aggregate using Select min (COL) //min () take minimum aggregation using SELECT SQRT (4);               //SQRT () Open square, Output 2select rand (); &nbsP; // rand () random select * from tablename order by rand ()
Date function
Select curdate (); //curdate (); Current date month Day select curtime (); //curtime (); current time hours Select now (); // Now (); current date and time month Day Select unix_timestamp (); //unix_ Timestamp (); returns the current UNIX timestamp select week (' 2015-10-10 '); //week (); Returns the week ordinal of the Year select year (' 2016-06-26 '); //year (); output 2016 , returns the current year Select datediff (' 2016-10-10 ', ' 2016-10-20 '); // output-10, return two dates in a few days
MySQL built-in functions