This article introduces some common functions of MySQ functions.
IF(expr,v1,v2) Returns v1 when the expr expression is true, otherwise returns v2
## after THEN. #CASE WHEN v1 THEN r1 [WHEN v2 THEN r2][...] [ELSE m] END
When a value in v1, v2... is true, return the value after THEN , otherwise return the value after ELSE
##VERSION() Return the version of MySql
##USER(), CURRENT_USER(), SYSTEM_USER(), SESSION_USER() Return the current user name
CHARSET(str) Returns the character set of str
COLLATION(str) Returns the character arrangement of str
LAST_INSERT_ID() Returns the last id value generated by AUTO_INCREMENT. If data is inserted in batches, returns the first one in the batch
Encryption--MD5(str ) Return str MD5 encryption 32-digit hexadecimal
Encryption ENCODE (str, pwd_str) Use pwd_str as the password to encrypt str, a binary string with the same length as str
Decrypt DECODE('str', pwd_str) Use pwd_str as the password to decrypt str, which is the inverse function of the above ENCODE()
FORMAT(x,n) Format the number Convert N from the from_base base to the to_base base
The above is the detailed content of Share examples of MySQ functions. For more information, please follow other related articles on the PHP Chinese website!