本文主要是介绍MySQL_Z14视图,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
#1. 创建视图emp_v1,要求查询电话号码以‘011’开头的员工姓名和工资、邮箱
create or replace view emp_v1
as
select last_name, email
from employees
where tell like "011%";#2. 要求将视图emp_v1 修改为查询电话号码以‘011’开头的并且邮箱中包含e字符的员工姓名和邮箱、电话号码
create or replace view emp_v1
as
select last_name, email, tell
from employees
where tell like "011%"
and email like "%e%;#3. 向emp_v1 插入一条记录,是否可以?
INSERT INTO emp_v1(last_name,salary,email,phone_number)
VALUES('Tom',2300,'tom@126.com','1322321312');#4. 修改emp_v1中员工的工资,每人涨薪1000
update emp_v1
set salary = salary +1000;#5. 删除emp_v1中姓名为Olsen的员工
delete from emp_v1
where last_name = 'Olsen';#6. 创建视图emp_v2,要求查询部门的最高工资高于12000 的部门id和其最高工资
create or replace emp_v2
as
select department_id, max(salary)
from departments
group by department_id
having max(salary) > 12000;#7. 向emp_v2 中插入一条记录,是否可以?#8. 删除刚才的emp_v2 和emp_v1
drop view emp_v2, emp_v1;
这篇关于MySQL_Z14视图的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!