The SQL GRANT statement is part of Data Control Language (DCL). It authorizes a user, role, or the special keyword PUBLIC to perform actions such as SELECT, INSERT, UPDATE, DELETE, EXECUTE, or USAGE on database objects (tables, views, schemas, functions, procedures, etc.). GRANT can also bestow entire roles. When used with WITH GRANT OPTION, the recipient can further delegate the same privileges to others. Privileges take effect immediately without requiring COMMIT but persist until explicitly revoked with REVOKE. GRANT must be executed by an object owner, a role with ADMIN OPTION, or a superuser, and the exact set of allowable privileges varies by object type and SQL dialect.
- privilege_list
(string) - Comma-separated privileges such as SELECT, INSERT, UPDATE, DELETE, ALL, EXECUTE, USAGE- object_name
(identifier) - Target table, view, sequence, function, procedure, schema, or database- grantee_list
(identifier) - One or more user names, role names, or the keyword PUBLIC- WITH GRANT OPTION
(keyword) - Allows each grantee to grant the same privileges to othersREVOKE, DENY, CREATE ROLE, ALTER DEFAULT PRIVILEGES, ROLE-BASED ACCESS CONTROL
SQL-92
Common privileges include SELECT, INSERT, UPDATE, DELETE, REFERENCES, EXECUTE, USAGE, and ALL. Availability depends on the object type and database vendor.
Usually the object owner, a role with ADMIN OPTION on the object, or a superuser. Regular users without sufficient rights will receive a permission-denied error.
Add WITH GRANT OPTION to the GRANT statement. This empowers the recipient to pass along the same rights to others.
No. Most databases apply GRANT immediately. Rolling back the surrounding transaction will not undo the privilege change; you must issue REVOKE explicitly.