尚硅谷day01 练习
作者:互联网
#day-01 课后练习
#1.查询员工12个月的工资总和,并起别名为ANNUAL SALARY
#注意null与''的区别
SELECT employee_id,last_name,salary * 12 *(1+commission_pct) "ANNUAL SALARY"
FROM employees;
SELECT employee_id,last_name,salary * 12 *(1+IFNULL(commission_pct,0)) "ANNUAL SALARY"
FROM employees;
#2.查询employees表中去除重复的job_id以后的数据
SELECT DISTINCT job_id
FROM employees;
#3.查询工资大于12000的员工姓名和工资
SELECT last_name,salary
FROM employees
WHERE salary > 12000
#4.查询员工工号为176的员工姓名和部门号
SELECT last_name,department_id
FROM employees
WHERE employee_id = 176;
#5.显示表departments的结构,并查询其中的全部数据
DESC departments;
SELECT *
FROM departments;
标签:last,name,day01,练习,查询,employees,硅谷,id,SELECT 来源: https://www.cnblogs.com/Yehuw-blogs/p/16077265.html