SQL复习-管理

2018-12-12  本文已影响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) );

上一篇下一篇

猜你喜欢

热点阅读