MYSQL study notes nine (common function)

First, the string functions
MySQL string functions

Function name effect
LENGTH string length calculation function that returns the byte length of the string
CONCAT combined string function, returns the result of connection parameters generated string of one or more parameters may
INSERT replacement string function
LOWER string in lowercase letters
UPPER converts a string to upper case letters
lEFT taken from the left character string, returns the number of characters left of the string
rIGHT taken from the right side of the character string, returns to the right of a plurality of character string
TRIM delete spaces left and right sides of the character string
rEPLACE string replacement function, returns the new replacement string
SUBSTRING taken string, returns the character specified length starting from a specified position transducer
rEVERSE string inversion (reverse) function returns the original string string reverse order of
two, using a numerical function
name of the function effect
ABS absolute value
SQRT establishes a secondary root
MOD remainder number of
the same function CEIL and CEILING two functions are returned smallest integer not less parameters, i.e. to take up whole
FLOOR rounded down, the return value is converted to a Bigin
the RAND it generates a 0 to 1 Between the random number, the integer parameter is passed, for generating a repeating sequence
ROUND-parameters of their rounded
SIGN returns the signum
same function and POW POWER two functions, the results are transmitted power parameter value
SIN seeking sine
ASIN seeking arcsine, mutually inverse function of the function SIN
COS establishes the cosine
ACOS negates the cosine function and COS mutually inverse function
TAN establishes the tangent
ATAN arc tangent of demand, with mutually inverse function TAN function
COT remainder tangent of
three, using the date and time the function
name of the function effect
CURDATE and CURRENT_DATE same effect two functions, the system returns the current date value
CURTIME CURRENT_TIME two functions and the same effect, the system returns the current value of the time
NOW and the same effect as two functions SYSDATE returns the current system date and time values
UNIX_TIMESTAMP obtain UNIX timestamp function returns a timestamp in UNIX-based unsigned integer
FROM_UNIXTIME the time stamp is converted to UNIX time format, with mutually inverse function UNIX_TIMESTAMP
MONTH obtain the specific date January
MONTHNAME obtain a specified date in the month English name
DAYNAME Gets the said period corresponding week English name
DAYOFWEEK Gets the specified date corresponding week index position value
wEEK Gets the specified date is the first few weeks of the year, returned a range of values whether or 0~52 1~53
DAYOFYEAR get Said given period is the first day of the year, the return value range is 366 ~ 1
DAYOFMONTH Gets the specified date is a month in the first few days, the return value range is 31 ~ 1
YEAR year of acquisition, the return value range is 1970~2069
TIME_TO_SEC time parameters into seconds
SEC_TO_TIME seconds to convert a time, the inverse function with each other TIME_TO_SEC
DATE_ADD and two function-ADDDATE same, are added to the date specified interval
DATE_SUB and two function-SUBDATE same, are subtracting the date specified by the time interval
ADDTIME time adder, add the specified time at the original time
SUBTIME time subtraction, subtracting a specified time in the original time
DATEDIFF acquisition interval between two dates, the return parameters subtracting 1 the value of the parameter 2
DATE_FORMAT specified date formatted according to the specified format parameter returns the value
wEEKDAY obtain a corresponding date specified days in a week index
four, using the system information function
name of the function effect
iF determination, flow control
IFNULL determines whether the air
CASE

Guess you like

Origin blog.51cto.com/14525650/2436590