Casing control functions
SELECT LOWER (' hellowrold'UPPER('HelloWorld');
Character control functions
SELECT REPLACE ('abcdababab','P','m');
Replace the character p in "Abcdababab" with M;
SELECT TRIM ('from');
Remove the spaces on both sides.
SELECT Ten,'-'*') from Employees
Lpad:salary characters are not enough 10, add '-' to the left to 10 characters;
Rpad:salary the character is not enough 10, add ' * ' to the right to gather 10 characters;
SELECT INSTR ('HelloWorld'P');
The query character ' P ' in the HelloWorld position;
SELECT LENGTH ('helloworl');
Returns the ' helloworl ' character length;
SELECT SUBSTR ('HelloWorld',2,5);
Starting from the second position of ' HelloWorld ', intercept 5 characters;
SELECT ROUND (123.4562ROUND(123.5560ROUND(153.456- 2);
Rounded
SELECT TRUNCATE (123.4562TRUNCATE(123.5560TRUNCATE(153.456- 2);
truncated after decimal point;
SELECT MOD (8);
Redundancy operation;
Check all employee information, if department number is 10,
--Print 1.1 times times its salary, department number 20th, print 1.2 times times its salary, and 30th department prints 1.3 times times its wages,
--the other prints 1.4 times times their wages.
SELECTemployee_id, last_name, salary, department_id, Casedepartment_id
when Ten ThenSalary* 1.1 when - ThenSalary* 1.2 when - ThenSalary* 1.3ELSESalary* 1.4END"New_salary";
condition judgment;
MySQL-Single-line function