Surnamed
benefit:
1, to facilitate the understanding
2, if the field you want to query the situation has the same name, an alias can be distinguished.
Method 1: Use as
select xingming as name;
select last_name as 姓,first_name as 名 from employees;
Second way: Use spaces
select last_name 姓,first_name 名 from employees;
Note: When there are among the alias keyword or spaces should be enclosed in double quotes to box up all aliases.
Deduplication
In the back of select add a keyword: distinct on it
select distinct department_id from employees;
The role of the +
In python "+" role is twofold:
1, the operator, the sum of two operands are numeric time
2, connector, when the two are strings, string concatenation
In mysql, + only one function: Operator
①: both operands are numeric, do adder
②: wherein one character is trying to convert the character into a numerical vertical, if the conversion is successful (string of digital content), then continue to do adder; cleavage conversion fails, then converted to a character value 0.
③: As long as one party is null, null is sure to get results