--6.1
grant all privileges
on 学生
to U1
with grant option;
grant all privileges
on 班级
to U1
with grant option;
--6.2
grant select,update(家庭住址)
on 学生表
to U2;
--6.3
grant select
on 班级
to public;
--6.4
create role R1;
grant select,update
on 学生
to R1
--6.5
grant R1
to U1
with admin option--这里是admin , grant是将权限赋给用户时用的
--7.1
grant select
on 职工
to 王明;
grant select
on 部门
to 王明;
--7.2
grant insert,delete
on 职工
to 李勇;
grant insert,delete
on 部门
to 李勇;
--7.3
--这里我刚开始想创建个视图
--但是发现这样不行
--7.4
grant select,update(工资)
on 职工
to 刘星;
--7.5
grant alter
on 职工
to 张新;
grant alter
on 部门
to 张新;
--7.6
grant all privileges
on 职工
to 周平
with grant option;
grant all privileges
on 部门
to 周平
with grant option;
--7.7
--首先创建一个视图
create view SALARY
as
select 部门.名称,max(工资),min(工资),avg(工资)
from 职工,部门
where 职工.部门号=部门的部门号
group by 职工.部门号;
grant select
on SALARY
to 杨兰
with grant option;
--8.1
revoke select
on 职工
from 王明;
revoke select
on 部门
from 王明;
--8.2
revoke insert,delete
on 职工
from 李勇;
revoke insert,delete
on 部门
from 李勇;
--8.3
--8.4
revoke select,update(工资)
on 职工
from 刘星;
--8.5
revoke alter
on 职工
from 张新;
revoke alter
on 部门
from 张新;
--8.6
revoke all privileges
on 职工
from 周平;
revoke all privileges
on 部门
from 周平;
--8.7
revoke select
on SALARY
from 杨兰;
【数据库】第四章课后作业
最新推荐文章于 2022-10-27 12:04:40 发布