SQL Commands | The Data Analytics Notes
SQL commands are the fundamental building blocks used to communicate with a Database Management System (DBMS).
They help us interact with databases by performing specific operations and queries on data.
Categories of SQL Commands
SQL commands are mainly divided into five categories:
DDL — Data Definition Language
Used to define and modify the structure of database objects.
· CREATE — Creates a database or database objects (tables, views, etc.)
· DROP — Deletes objects from the database
· ALTER — Modifies the structure of an existing database object
· TRUNCATE — Removes all records from a table (cannot be rolled back)
· RENAME — Renames an existing database object
DQL — Data Query Language
Used to retrieve data from the database.
· SELECT — Retrieves data from one or more tables
DML — Data Manipulation Language
Used to manage data stored in tables.
Get Miranjali Mane’s stories in your inbox
Join Medium for free to get updates from this writer.
· INSERT — Adds new rows (records) to a table
· UPDATE — Modifies existing records in a table
· DELETE — Removes specific records from a table
DCL — Data Control Language
Used to control access and permissions in the database.
· GRANT — Provides user access privileges
· REVOKE — Removes user access privileges
TCL — Transaction Control Language
Used to manage transactions in the database.
· COMMIT — Saves all changes made during a transaction
· ROLLBACK — Reverts changes if an error occurs
· SAVEPOINT — Sets a point in a transaction to roll back to if needed
· SET TRANSACTION — Defines the properties of a transaction, such as isolation level and read/write mode, before it begins.
Takeaway
SQL commands form the foundation of working with databases. Understanding these categories helps us execute queries correctly and manage data effectively.
Next Up
Before implementing SQL commands, we’ll explore the SQL interface and understand how it is structured.



