Using the GRANT Command

Using the GRANT Command

The SQL GRANT command is used to grant access privileges to database objects and role authorizations. For example, the following statement grants the user username the right to SELECT tabname:

GRANT SELECT ON tabname TO username

Some database vendors, such as Oracle and MySQL, have extended GRANT‘s abilities to create users and change existing user passwords. Indeed, prior to introduction of the CREATE USER command in Oracle 7, the only way to create a user in Oracle was to use the GRANT command:

GRANT CONNECT to username IDENTIFIED BY user_password

This combination of creating users and simultaneously assigning them database privileges eliminates the need to separately grant the required privileges to newly created users. Interestingly, the GRANT command’s counterpart, REVOKE, was not extended to delete users.

See also  5 Benefits of Using Time Tracking Software

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist