以下内容全是标准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 杨兰;