First section: Date and Time functions
1,curdate () returns the current date;
2,curtime () returns the current time;
3,month (d) Returns the month value in Date D, in the range 1~12
SELECT curdate (), Curtime (), MONTH (birthday) as M from t_t;
Section II: String functions
1,char_length (s) calculates the number of characters of the string s;
2,upper (s) to turn all letters into uppercase letters;
3,lower (s) turns all letters into lowercase letters;
SELECT username,char_length (UserName), UPPER (UserName), LOWER (userName) from t_t;
Section III: Mathematical Functions
1,a BS (x) to seek absolute value
SELECT num,abs (num) from t_t;
2,SQRT (x) to find the square root
3,mod (x, y) Seek redundancy
SELECT SQRT (4), MOD (9,4) from t_t;
Section Fourth: Cryptographic functions
1,password (str) password encryption is generally not reversible for the user
INSERT into t_t VALUES (NULL, ' 2013-1-1 ', ' A ', 1,password (' 123456 '));
2,MD5 (str) ordinary encryption irreversible
INSERT into t_t VALUES (NULL, ' 2013-1-1 ', ' A ', 1,md5 (' 123456 '));
3,encode (STR,PSWD_STR) encryption function, the result is a binary number, you must use the Blob Type field to save it;
INSERT into t_t VALUES (NULL, ' 2013-1-1 ', ' A ', 1,md5 (' 123456 '), ENCODE (' abcd ', ' AA '));
4,decode (CRYPT_STR,PSWD_STR) decryption function;
SELECT DECODE (pp, ' AA ') from t_t WHERE id=5;
MySQL Common functions