← Back to Chapters

Classification of SQL Commands

? Classification of SQL Commands

⚡ Quick Overview

SQL (Structured Query Language) is used to store, change, and read data in a database. To make it easy to study, SQL commands are divided into groups. Each group has a simple job, like creating tables, changing data, reading data, handling transactions, or giving permissions.

DDL – Structure   DML – Data   TCL – Transactions   DQL – Queries   DCL – Security

? Five Pillars of SQL Commands

Imagine each SQL category as a pillar holding a small “SQL temple”.

DDL Structure DML Change Data DQL Read Data TCL Transactions DCL Security SQL COMMANDS

? Key Concepts

  • DDL (Data Definition Language): Used to create and change the structure of the database. You define things like tables, columns, and basic rules. Examples: CREATE, ALTER, DROP, TRUNCATE, RENAME, COMMENT.
  • DML (Data Manipulation Language): Used to work with the data inside the tables. You add, update, or delete rows. Examples: INSERT, UPDATE, DELETE, MERGE.
  • TCL (Transaction Control Language): Used to control a group of data changes. You can confirm all changes or undo them. Examples: COMMIT, ROLLBACK, SAVEPOINT, SET TRANSACTION.
  • DQL (Data Query Language): Used to read data from the database. Main command: SELECT.
  • DCL (Data Control Language): Used to manage who can do what in the database. You give or remove permissions. Examples: GRANT, REVOKE.

? Where Are These Commands Used?

  • DDL: Used when setting up a new database or changing its design (for example, creating tables and indexes in MySQL or PostgreSQL).
  • DML: Used by real apps like shopping sites or billing systems to add, change, or delete customer and order data.
  • TCL: Very important in banking and finance, where many related changes must succeed together or fail together.
  • DQL: Used in reports, dashboards, and analytics tools to read and show useful data from tables.
  • DCL: Used by database admins to control which user can see or change which data, so that the system stays secure.

? Mind Map of SQL Categories

Think of SQL in the center, and each command type as a branch coming out of it.

SQL DDL DML DQL TCL DCL

? MySQL, SQL, DBMS, RDBMS, NoSQL – What’s the Difference?

When you start learning MySQL, many words sound similar and confusing. This table gives a very simple difference between the common terms.

? Quick Comparison Table

Term Simple meaning Example / Note
DBMS Database Management System – any software that stores and manages data. Very general word. Can be old systems, simple file-based systems, etc.
RDBMS Relational DBMS – data is stored in tables with rows & columns. MySQL, PostgreSQL, Oracle, SQL Server are all RDBMS.
SQL A language used to talk to a relational database. Like English for humans, SQL is for databases. SELECT, INSERT are SQL commands.
MySQL A popular RDBMS software that uses SQL language. Product / tool you install and use. You write SQL inside MySQL.
NoSQL Databases that are not purely table-based. They may store JSON documents, key–value pairs, graphs, etc. MongoDB (documents), Redis (key–value), Neo4j (graph) are NoSQL databases.

? In simple words: MySQL is a tool, SQL is the language, RDBMS is the type of system (table-based), DBMS is the general word, and NoSQL is a different family of databases.

? Conceptual Patterns (No SQL Code)

  • DDL Pattern: “Design the storage.” You decide what kind of tables you need and what columns they have.
  • DML Pattern: “Work with stored data.” You add new data, change existing data, or remove data you do not need.
  • DQL Pattern: “Ask questions.” You request data like “show all users from Pune” or “list orders above 1000 rupees”.
  • TCL Pattern: “Group changes.” You treat many changes as one block: either keep all of them or cancel all of them.
  • DCL Pattern: “Control access.” You decide who can see data and who can change it.

? Tips & Best Practices

  • Whenever you see a new SQL command, first ask: “Is this DDL, DML, DQL, TCL, or DCL?”
  • Think in layers while designing a system: structure (DDL), data (DML/DQL), and safety (TCL/DCL).
  • Name your SQL files clearly, like schema_ddl.sql for design and data_dml.sql for inserts.
  • Remember: DDL = shape, DML/DQL = content, TCL/DCL = safety and control.
  • Use small diagrams like pillars, layers, and trees in your notebook. They help a lot in revision and viva.

? Try It Yourself

  • Draw the five pillars picture in your notebook and write at least 2 commands under each pillar.
  • Draw a three-layer diagram: bottom = DDL, middle = DML/DQL, top = TCL/DCL. Add 1–2 lines of explanation for each layer.
  • Make a mind map with “SQL” in the center and branches for DDL, DML, DQL, TCL, and DCL. Under each branch, add some command names.
  • When you practice SQL, write the category (DDL/DML/…) as a small note beside each command.
  • Try to explain all 5 categories to a friend using only simple examples, like school, bank, or shop examples, without saying any SQL keywords.