Common SQL functions
1. Arithmetic Functions
SELECT ABS (-2), operating results for the 2
SELECT MOD (101,3), the results of run 2
SELECT ROUND (37.25,1), operating results 37.3
2. String Functions
SELECT CONCAT ( 'abc', 123), operating results for the bac123
SELECT LENGTH ( 'Hello'), the result of operation 6
SELECT CHAR_LENGTH ( 'Hello'), the results of 2
SELECT LOWER ( 'ABC'), operating results for the abc
SELECT UPPER ( 'abc'), operating results for the ABC
SELECT REPLACE ( 'fabcd', 'abc', 123), operating results for the f123d
SELECT SUBSTRING ( 'fabcd', 1,3), operating results for the fab
3. Date Functions
SELECT CURRENT_DATE (), operating results for the 2019-04-03
SELECT CURRENT_TIME (), the result is run 21:26:34
SELECT CURRENT_TIMESTAMP (), operating results for the 2019-04-03 21:26:34
SELECT EXTRACT (YEAR FROM '2019-04-03'), the result of operation 2019
It should be noted that, DATE Date must be in the form of yyyy-mm-dd.
4. The transfer function
Naming suggestions:
1. Keyword and function names in all caps
2. The database names, table names, field names all lower case
3. SQL statement must end with a semicolon