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