SQL Commands
SQL Commands
Types of
Commands
Explained
💡 Unlock the power of SQL with
these essential commands! 🚀
1.Data Definition Language (DDL)
DDL deals with defining and managing the
database structure.
It includes commands to create, modify, and
delete database objects (tables, indexes,
views, etc.), but not data.
Common DDL commands:
CREATE: Used to create database objects
(e.g., tables, indexes, views).
DROP: Deletes objects from the database.
ALTER: Modifies the structure of the
database (e.g., adding or deleting columns).
TRUNCATE: Removes all records from a
table.
COMMENT: Adds comments to the data
dictionary.
2.Data Manipulation Language
(DML)
DML deals with manipulating data within the
database.
It includes commands to insert, update, and
delete data.
Only this commands have UNDO option.
Common DML commands:
INSERT: Adds new rows or record to a table.
UPDATE: Modifies existing data in a table.
DELETE: Removes data from a table.
3.Data Query Language (DQL)
DQL is used for querying data within schema
objects.
It includes the SELECT statement.
DQL retrieves data from the database and
imposes order upon it.
DQL is the most used SQL command.
4. Data Control Language (DCL)
DCL controls access and security.
It includes commands to grant or revoke
permissions.
It manages user permissions and security.
Common DCL commands:
GRANT: Provides specific privileges to users
or roles.
REVOKE: Removes specific privileges from
users or roles.
5. Transaction Control Language
(TCL)
TCL manages transactions and data integrity.
It includes commands to control the flow of
transactions.
It ensures data consistency and integrity.
Common TCL commands:
COMMIT: Saves changes to the database.
ROLLBACK: Undoes changes made during
the current transaction.
SAVEPOINT: Sets a point within a
transaction to which you can later roll back.
THANK
YOU