> For the complete documentation index, see [llms.txt](https://www.pranaypourkar.co.in/the-programmers-guide/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.pranaypourkar.co.in/the-programmers-guide/database/sql-databases/sql-fundamentals/sql-commands/dcl-data-control-language.md).

# DCL (Data Control Language)

DCL (Data Control Language) commands are used to manage access privileges for users and database objects. These commands allows to grant specific permissions to users or roles, enabling them to interact with the database in controlled ways.

## GRANT

Assigns specific privileges (e.g., SELECT, INSERT, UPDATE, DELETE) on a table, schema object, or system privilege to a user or role.

* Syntax

```
GRANT privilege_type[(column_list)] ON [schema_name.]object_type [object_name] TO user_name [role_name];
```

* Example

```
GRANT SELECT, INSERT ON Customers TO Sales_User;

-- Granting all privileges on the Orders table to the Manager role
GRANT ALL ON Orders TO Manager;

-- Granting CREATE SESSION system privilege to a new user
GRANT CREATE SESSION TO New_User;
```

## REVOKE

Takes away previously granted privileges from a user or role.

* Syntax

```
REVOKE privilege_type[(column_list)] ON [schema_name.]object_type [object_name] FROM user_name [role_name];
```

* Example

<pre><code>-- Revokes delete permission
<strong>REVOKE DELETE ON Orders FROM Marketing_User;  
</strong>-- Revoking all privileges on the Customers table from the Guest role
REVOKE ALL ON Customers FROM Guest;
</code></pre>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://www.pranaypourkar.co.in/the-programmers-guide/database/sql-databases/sql-fundamentals/sql-commands/dcl-data-control-language.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
