MySQL built-in functions

Source: Internet
Author: User

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 spaces
Mathematical 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.