js获取list的长度MySQL-基础题练习题-视图(12)
数据在本专栏的第⼀篇博客⾥保持专注的英文
题⽬汇总
13.1.创建视图emp_v1,要求查询电话号码以"011"开头的员⼯姓名和⼯资、邮箱
CREATE
OR REPLACE VIEW emp_v1 AS SELECT
last_name,include音标
salary,
email
FROM
employeesdecorating
runtime是什么软件
WHERE
phone_number LIKE '011%';
13.2.创建视图emp_v2,要求查询部门的最⾼⼯资⾼于12000的部门信息
#1. 视图⽅法:
CREATE
OR REPLACE VIEW emp_v2 AS SELECT
max( salary ) mx_sal,
department_id
FROM
employees
GROUP BY
department_id
HAVING
max( salary )> 12000;
#
mysql面试题汇总
SELECT
d.*,
<_sal
FROM
departments d
JOIN emp_v2 m ON m.department_id = d.department_id;
我觉得不能只看代码量,上⾯的视图⽅法可读性会更好⼀些
#2. ⼦查询⽅法:
SELECT
d.*,
<_sal
FROM
departments d
JOIN ( SELECT max( salary ) mx_sal, department_id FROM employees GROUP BY department_id HAVING max( salary )> 12000 ) m ON m.department_ id = d.department_id;

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。