May 2018
Intermediate to advanced
576 pages
30h 25m
English
It is often desirable to give a group of users similar permissions to a group of database objects. To do this, you first assign all the permissions to a proxy role (also known as a permission group), and then assign the group to selected users, as follows:
CREATE GROUP webreaders; GRANT SELECT ON pages TO webreaders; GRANT INSERT ON viewlog TO webreaders; GRANT webreaders TO tim, bob;
Now both tim and bob have the SELECT privilege on the pages table and INSERT on the viewlog table. You can also add privileges to the group role after assigning it to users. Consider the following command:
GRANT INSERT, UPDATE, DELETE ON comments TO webreaders;
After running this command, both bob and tim have ...