SQL Statements
SQL Statements
DDL COMMANDS
CREATE TABLE:
1.
2. DROP TABLE
3. alter
DML
The SQL commands that deal with the manipulation of data present in the database belong to DML
or Data Manipulation Language and this includes most of the SQL statements.
It is the component of the SQL statement that controls access to data and to the database. Basically,
DCL statements are grouped with DML statements.
2. insert
3. update
4. Delete
DCL COMMANDS
DCL Commands
Data Control Language commands control access to the database and manage user permissions. DCL
commands include:
TCL Commands
Transaction Control Language Commands are used to manage transactions within a database. TCL
commands include:
Data control, as the name suggests, means controlling the data stored in the database. It refers to
managing access and permissions to a database. Data control is done with the help of (Data Control
Language) DCL Commands in SQL.
DCL commands in SQL provide a way to authorize access to the data. They limit the users to
access the data and manipulate it.
Some Data Control Language (DCL) commands are GRANT, REVOKE, and DENY.
GRANT command grants the privileges, and the REVOKE command takes away the authority
or the privileges.
This ensures the security and integrity of the database management system.
1. GRANT Command
This DCL command grants specific privileges to users on a table, view, or stored procedure.
Syntax
or
where
privilege_name
object_name
It refers to the name of the table, view, or object on which the privilege has to be granted.
user_name
It means that the user who has been granted some privileges can further grant those privileges to
other users.
Example
1 Sasha 17 Faridabad 80
2 John 18 Agra 91
3 Sara 17 Hisar 86
4 Rohan 16 Faridabad 79
5 Virat 18 Delhi 80
2.REVOKE Command
This command revokes the previously granted privileges through the GRANT command. from a user.
It reverts to the point when there is no access.
Syntax
where
privilege_name
object_name
user_name
It refers to the name of the user from which the privilege is being revoked.
Example
1 Sasha 17 Faridabad 80
2 John 18 Agra 91
3 Sara 17 Hisar 86
4 Rohan 16 Faridabad 79
5 Virat 18 Delhi 80
Complexity: Implementing DCL commands may require a steep learning curve for
administrators unfamiliar with command-line interfaces.
Risk of errors: Manual entry of commands increases the likelihood of human error,
potentially leading to system misconfigurations or data loss.
Limited user interface: DCL commands typically lack graphical user interfaces, making them
less intuitive for novice users compared to graphical management tools.
Additional : sql basic commands for bolean and sql injection and how do the logic work