8. SQL Statements : GRANT (privilege) : GRANT (privilege) Examples
 
Share this page                  
GRANT (privilege) Examples
1. Grant select and update privileges on the salary table to the group, acct_clerk.
GRANT SELECT, UPDATE ON TABLE salary
    TO GROUP acct_clerk;
2. Grant update privilege on the columns, empname and empaddress, in the employee table to the users, joank and gerryr.
GRANT UPDATE(empname, empaddress)
    ON TABLE employee
    TO joank, gerryr;
3. Grant permission to the public to execute the monthly_report procedure.
GRANT EXECUTE ON PROCEDURE monthly_report
    TO PUBLIC;
4. Define a query_row_limit privilege of 100 rows on the new_accts database for users in the group, new_emp.
GRANT QUERY_ROW_LIMIT 100 ON DATABASE new_accts
    TO GROUP new_emp;
5. Grant unlimited rows to the role identifier, update_emp, which allows unlimited rows to be returned to any application that is associated with the role identifier, update_emp.
GRANT NOQUERY_ROW_LIMIT ON DATABASE new_acct
    TO ROLE update_emp;
6. Enable the inventory_monitor role to register for and raise the stock_low database event.
GRANT REGISTER, RAISE ON DBEVENT stock_low
    TO ROLE inventory_monitor
7. Enable any employee in accounting to change columns containing salary information.
GRANT UPDATE ON employee.salary, employee.socsec
    TO GROUP accounting;
8. Enable the accounting manager, rickr, complete access to salary information and to grant permissions to other user.
GRANT ALL ON employee TO rickr WITH GRANT OPTION;
9. Enable any user to create a table constraint that references the employee roster.
GRANT REFERENCES ON emp_roster TO PUBLIC;