Table Grant Examples
Here are examples of granting permissions on tables:
1. Grant select permission on the employee table to user freddy:
GRANT SELECT ON employee TO freddy;
2. Grant select permission on the employee and department_table tables to individual users sally and ralph:
GRANT SELECT ON employee, department_table
TO sally, ralph;
3. Grant both select and update permissions on the employee table to user rollin. Note that you must be able to select values to update them:
GRANT SELECT, UPDATE ON employee TO rollin;
4. Grant select and update permissions on the columns empname and empaddress in the employee table to users joank and gerryr:
GRANT SELECT, UPDATE (empname, empaddress)
ON employee TO joank, gerryr;
5. Grant references permission on the “address” table to user “joe”:
GRANT REFERENCES ON address TO joe;
6. Grant references permission on selected columns of the “finder” table to user “joe”:
GRANT REFERENCES ON finder (lname, finit, state)
TO joe;
User “joe” can then create a referential constraint on table “address” or the specified columns of table “finder.” Note that he does not need the select permission to create the referential constraint.
7. Grant all query permissions (select, insert, update, delete, and references) on the phonelist table to all users:
GRANT ALL ON phonelist TO PUBLIC;
Last modified date: 01/30/2023