Mysql common functions

Source: Internet
Author: User


Mysql-related things (9) commonly used function links: Mysql-related things (1) mysql Installation http://www.bkjia.com/database/201210/162314.html Mysql (2) Database Operations http://www.bkjia.com/database/201210/162315.html Mysql (3) operations on Data Tables http://www.bkjia.com/database/201210/162316.html Mysql (4) Data Table query operations http://www.bkjia.com/database/201210/162317.html Mysql (5) operation time http://www.bkjia.com/database/201210/162318.html;Mysql Those things (6) String Pattern Matching http://www.bkjia.com/database/201210/163969.html;Mysql Those things (7) In-depth select query http://www.bkjia.com/database/201210/163970.html;Mysql Those things (8) Index http://www.bkjia.com/database/201210/163971.html 1. The string function www.2cto.com CANCAT (S1, S2 ,... sn) Select S1, S2 ,... sn is a string of INSERT (str, x, y, instr). String 'str' starts from position x, and y is replaced with string 'str' (str) convert all characters in the str string to lowercase UPPER (str). Convert all characters in the str string to uppercase LEFT (str, x). Return the x-character RIGHT (str, str, x) returns the x-character LPAD (str, n, pad) on the rightmost side of the str string. Fill the leftmost side of str with the string pad until the length is n characters, n, pad) Fill the rightmost side of str with the string pad until the length is n characters long LTRIM (str) Remove the spaces on the left side of the string str RTRIM (str) removes the space at the right of the str string, REPEAT (str, x), and returns the result STRC that is repeated x times. MP (s1, s2) compares the s1 and s2TRIM (str) strings to remove the spaces (str, x, y) at the end of the string and the header of the line) returns string 2 of String Length y starting from string str x. returns the absolute value of x, including CEIL (x), and returns the FLOOR (x) value greater than x) returns the maximum integer MOD (x, y) less than x. returns the modulo RAND () of x/y. returns 0 ~ The random value ROUND (x, y) in 1 returns the rounded y decimal value of parameter x TRUNCATE (x, y) returns x rounded to y decimal places. Result 3: returns the current date, CURTIME (), and returns the current time () returns the current date and time UNIX_TIMESTAMP (date). returns the Unix timestamp FROM_UNIXTIME of the date. returns the date value of the Unix timestamp WEEK (date) returns the week YEAR (date) of the YEAR from date. returns the year hour (time) of the date. returns the HOUR value of time. MINUTE (time) returns the MINUTE value of time. MONTHNAME (date) returns the month name DATE_FORMAT (date, fmt) of date. returns the date value DATE_ADD (date, INTERVAL expr type) formatted by string fmt) returns a date or time value plus a time interval value DATEDIFF (expr, expr2) returns the number of days between the start time expr and the end time expr2. 4. IF (value, t f) if the value is true, t is returned; otherwise, f IFNULL (value1, value2) is returned. If value1 is not null, value1 is returned, otherwise, return value2 case when [value1] THEN [result1]... ELSE [default] END if value1 is true, result1 is returned; otherwise, default CASE [expr] WHEN [value1] THEN [result1] is returned... ELSE [default] END if expr is equal to value1, result1 is returned; otherwise, default www.2cto.com 5 is returned. Other functions DATABASE () are returned. The current DATABASE name VERSION () is returned. The current database version user () is returned () returns the current logon username INET_ATON (IP). returns the IP address number INET_NTOA (). returns the IP address PASSWORD (). returns the encrypted str version MD5 (). returns the MD5 value of the str string.

Related Article

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.