• 数据库作业11:SQL练习7


    把查询Student表权限授给用户U1

    grant select
    on student
    to u1;
    

    点开选择,后面打勾
    把对Student表和Course表的全部权限授予用户U2和U3

    grant all privileges
    on student
    to u2,u3;
    grant all privileges
    on course
    to u2,u3;
    

    把对表SC的查询权限授予所有用户

    grant select
    on sc
    to public;
    

    无异常

    把查询Student表和修改学生学号的权限授给用户U4

    grant select,update(sno)
    on student
    to u4;
    

    把对表SC的INSERT权限授予U5用户,并允许他再将此权限授予其他用户。

    grant insert
    on sc
    to u5
    with grant option;
    

    U5授权给U6

    grant insert
    on sc
    to u6
    with grant option;
    

    把用户U4修改学生学号的权限收回

    revoke update(sno)
    on student
    from u4;
    

    权限收回成功
    收回所有用户对表SC的查询权限

    revoke select
    on sc
    from public;
    

    把用户U5对SC表的INSERT权限收回

    revoke insert
    on sc
    from u5;
    

    这里除了点插曲,显示错误,结果发现是权限问题本身就不存在,我就又重来了一遍全过程。。。

    通过角色来实现将一组权限授予一个用户。

    create role a1;
    grant select,update,insert
    on student
    to a1;
    grant a1
    to U1,U2,U3;
    revoke a1
    from U1,U2;
    exec sp_droprolemember ‘a1’,‘U1’
    exec sp_droprolemember ‘a1’,‘U2’
    
    

    角色的权限修改。

    grant delete
    on student
    to a1;
    

    差不多的操作
    使a1减少了SELECT权限

    revoke select
    on student
    from a1;
    

    修改和授权总感觉差不多

    建立计算机系学生的视图,把对该视图的SELECT权限授于王平,把该视图上的所有操作权限授于张明

    create view cs_s
    as
    select *
    from student
    where sdept=‘cs’;
    
    grant select
    on cs_s
    to 王平;
    
    grant all
    on cs_s
    to 张明;
    

    对修改SC表结构或修改SC表数据的操作进行审计

    audit alter,update
    on sc;
    

    审计时有部分语法错误

    取消对SC表的一切审计

    onaudit alter,update
    on sc;
    
  • 相关阅读:
    javascript 中的nextSibling和previousSibling使用注意事项
    inline-block(行内区块元素)的详解和应用
    createElement()结合appendChild()的实例
    JavaScript 的setAttribute兼容性解决
    css 雪碧图 及jquery定位代码
    jquery图片轮播代码
    jquery 的attr()方法解析
    用jquery修改默认的单选框radio或者复选框checkbox选择框样式
    html form <label>标签基础语法结构与使用案例教程(转载)
    CoreText
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13285170.html
Copyright © 2020-2023  润新知