Selected topic
Data Control Language Dcl
Prefer practical output? Use related tools below while reading.
### GRANT
Purpose: Grant privileges to a user or role.
sql
GRANT privilege ON object_name TO {user|role};sql
-- Grant SELECT privilege on table "employees" to user "john"
GRANT SELECT ON employees TO john;GRANT command is used to grant the SELECT privilege on the employees table to the user named john.SELECT: allows a user to read data from a table.INSERT: allows a user to insert new records into a table.UPDATE: allows a user to modify existing records in a table.DELETE: allows a user to delete records from a table.ALL PRIVILEGES: grants all privileges on an object.sql
-- Grant SELECT privilege on table "employees" to role "hr_staff"
GRANT SELECT ON employees TO hr_staff;
Note that roles can be granted only in the context of an object, not globally.