MySQL built-in functions

Source: Internet
Author: User

Used in the SELECT statement, the CAN and clause where the by and have update delete

A field can be called as a variable in a function, and the value of the variable is the record of each row corresponding to that column.

One, the string function
1, CONCAT
2. Insert (Str,x,y,insert) starts the string X position, and the Y string length is replaced with a string insert;
3, Lower () Upper ()
4. Left (str,x) right (Str,y) returns y/x characters null does not return
5, Lpad (Str,n,pad) Rpad (Str,n,pad) complement all characters N strings
6, Trim Ltrin RTrim Remove space
7, REPLACE (STR,A,B);
8, STRCMP (ST1,ST2) Ask code size
9, SUBSTRING (str,x,y) Intercept string
Second, numerical function
1, ABS (x) returns the absolute value of X
2, Ceil ()
3. Floor ()
4, mod (x, y) return modulo
5, rand () 0-1
6, round (x, y) rounding y decimal places
7, truncate (x, y) return truncated y to decimal
Third, date function
Curdate () Current date curtime () Current time now () Current date time
Unix_timestamp (now ()) Get timestamp
From_unixtime (timestamp)
Week (now ()) year (now ())
Hour (Curtime ()) minute (Curtime ())
MonthName (now ())
Date_format (now (), "%y-%m-%d%h:%i:%s")
Iv. Process Control functions
if (val,a,b)
If NULL (VAL1,VAL2)
Case is [VA] then [RESULT1] else [default] End
Case and then
V. Other functions Select
Database ()
Version ()
User ()
Inet_aton (' IP ')
Inet_ntoa (' Inet_aton (' IP ') ')
Password ()
MD5 ()

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.