美文网首页
SQL复习-管理

SQL复习-管理

作者: 夏日奶油汽水 | 来源:发表于2018-12-12 12:33 被阅读0次

    设置能见度 CREATE VIEW view_name AS <expression>

    CREATE VIEW Dpt_size(name, num_of_employee) AS (SELECT D.name, COUNT(*) FROM Departments D, Works_in W WHERE D.department_id = W.department_id GROUP BY W.department_id );

    授权GRANT <sth> ON <table name or view name> TO <user/role list>

    GRANT SELECT ON Departments TO Johnson, Brown;

    GRANT UPDATE(budget) ON Departments TO manager;

    REVOKE SELECT ON Departments FROM Johnson, Brown;

    CREATE ROLE manager;

    GRANT manager TO Brown;

    设置条件(Assertions are checked whenever the involved tables

    are updated --> very expensive!)

    CREATE ASSERTION EmpsNoLessThanDepts CHECK ( (SELECT COUNT(*) FROM Departments) <=(SELECT COUNT(*) FROM Employees) );

    相关文章

      网友评论

          本文标题:SQL复习-管理

          本文链接:https://www.haomeiwen.com/subject/lfvuhqtx.html