select
name n,
age as age
from ...
mysql中的where子句不能使用字段别名
查询姓名和年薪
USE hr;
SELECT employee_id,CONCAT(first_name,' ',last_name) NAME,salary*12 anual_salary
FROM employees;
查询姓名和年薪按年薪大于100000的
USE hr;
SELECT employee_id,CONCAT(first_name,' ',last_name) AS NAME,salary*12 AS anual_salary
FROM employees
WHERE salary*12>100000;
网友评论