第四章习题

以下内容全是标准SQL中运行的语句
6.

先创建表

create table Student
(Snum char(15) unique,
Sname char(10),
Sage int,
Ssex char(5),
Sadd char(20),
Scnum char(5)
);
 
create table Class
(Cnum int,
Cname char(10),
Cte char(10),
Cmon char(10)
);

(1)

GRANT ALL PRIVILEGES
on  Student,class
TO U1
with GRANT OPTION;

(2)

grant select,UPdate(Sadd)
on table student
to U2;

(3)

grant select
on table student
to public;

(4)

grant select,UPDATE
on table student
to R1;

(5)

GRANT R1
TO U1
WITH ADMIN OPTION;

创建表

create table Staff
(Snum char(15) unique,
 Sname char(10),
 Sage int,
 Spo char(5),
 Swa int,
 Sde char(5)
);
 
create table Dep
(Dnum int,
 Dname char(10),
 Dmag char(10),
 Dadd char(10),
 Dcall char(13),
 );

(1)

grant select
on staff,dep
to 王明;

(2)

grant insert,delete
on staff,dep
to 李勇;

(3)

grant select
on table staff
when user()=sname
to all;

(4)

grant select,update(swa)
on table staff
to 刘星;

(5)

grant update
on table staff,dep
to 张新;

(6)

grant ALL PRIVILEGES
on table staff,dep
to 周平
WITH GRANT OPTION;

(7)

GRANT VIEW STAFF_SWA(W_NAME,MINS,MAXS,AVGS)
AS
SELECT DEP.DNAME,MAX(SWA),MIN(SWA),AVG(SWA)
FROM STAFF,DEP
WHERE STAFF.snum=dep.dnum;

grant select
on staff_swa
to 杨兰;
revoke select
on table staff,dep
from 王明;


revoke insert,delete
on table staff,dep
from 李勇;

revoke select
on table staff
when user()=sname
from all;

revoke select,update(swa)
on table staff
from 刘星;

revoke update
on table staff,dep
from 张新;


revoke ALL PRIVILEGES
on table staff,dep
from 周平;

revoke select
on staff_swa
from 杨兰;
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值