Sitemap

Understanding MYSQL Commands With FlowCharts

4 min readMar 27, 2026

--

→ Introduction to MYSQL :

  • MYSQL is one of the most popular open-source relational database management systems used to store, organize, and manage data efficiently
  • MYSQL uses Structured Query Language (SQL) to perform operations such as retrieving, inserting, updating, and deleting data known for its reliability, performance, and ease of use, MYSQL is widely used in web applications, business systems, and data analytics, making it an essential tool for developers and data professionals

→ Why SQL Commands Are Divided Into Categories

  • SQL commands are divided into categories to make database operations organized, easy to understand, and efficient to use
  • Since databases involve different types of tasks - like creating data structures, managing data, controlling access, and handling transactions - grouping commands helps users quickly identify and apply the right operation
  • SQL commands are divided into categories to make database operations clear, structured, and efficient. This classification helps users understand the purpose of each command and ensures smooth database management.

Main Reasons To Divided Into Categories :

  • Better Organization
  • Easy To Learn & Usage
  • Improve Readability
  • Efficient Database Management
  • Better Security Control

SQL Command Categories :

  • DDL (Data Defination Language)
  • DML (Data Manipulation Language)
  • DQL (Data Query Language)
  • DCL (Data Control Language)
  • TCL (Transaction Control Language)

→ Flow Chart

Press enter or click to view image in full size

DDL (Data Defination Language) :

  • It is a category of SQL commands used to define, create, modify, and delete the structure of database objects such as tables, schemas, and indexes
  • In simple words it is used to design and manage the structure of the database, not the actual data.

Why Do We Use DDL(Data Defination Language) :

  • To create database objects
  • To modify structure
  • To delete database objects
  • To reset table quickly
  • It is used to design and control how the database is built, not the data inside it

Commands in DDL :

CREATE :

syntax : CREATE DATABASE DB_NAME;

DROP :

syntax (for drop database) : DROP DATABASE DB_NAME;

syntax (for drop table) : DROP DATABASE TABLE_NAME;

ALTER :

syntax : ALTER TABLE TABLE_NAME ADD COL_NAME DATATYPE;

Press enter or click to view image in full size

TRUNCATE :

syntax : TRUNCATE TABLE_NAME;

DML (Data Manipulation Language) :

  • It is used to insert, update, and delete data within database tables

Why DO We Use DML(Data Manipulation Language) :

  • To insert new data
  • To update existing data
  • To delete the data
  • It is used to modify or handle data

Commands in DML :

Get Mokshagna jagarlamudi’s stories in your inbox

Join Medium for free to get updates from this writer.

INSERT :

  • syntax : INSERT INTO TABLE_NAME(COL_1,COL_2 …e.t.c) VALUE(VAL_1,VAL_2 …e.t.c);

UPDATE :

  • syntax : UPDATE TABLE_NAME SET COL_NAME = NEW_VALUE WHERE CONDITION;

DELETE :

  • syntax : DELETE FROM TABLE_NAME WHERE CONDITION;

LOCK :

  • syntax : LOCK TABLES table_name READ/WRITE, …;

UNLOCK :

  • syntax : UNLOCK TABLES;

DCL (Data Control Language) :

  • It is used to control access and permissions in the database

Why Do We Use DCL(Data Control Language) :

  • To give access
  • To remove access
  • It is used for user control & security

Commands in DCL :

GRANT :

  • syntax : GRANT PRIVILEGE_LIST ON OBJECT_NAME TO USER_NAME;

REVOKE :

  • syntax : REVOKE PRIVILAGE_LIST ON OBJECT_NAME FROM USER_NAME;

TCL (Transaction Control Language) :

  • It is used to manage transactions and ensure data consistency

Why Do We Use TCL(Transaction Control Language) :

  • To save changes peremently
  • To undo changes back
  • To set checkpoints
  • It is used to control transaction safely

Commands in TCL :

COMMIT :

  • syntax : COMMIT;

ROLLBACK :

  • syntax : ROLLBACK;

SAVEPOINT :

  • syntax : ROLLBACK SAVEPOINT SAVEPOINT_NAME;

DQL (Data Query Language) :

  • It is used to retrieve or fetch data from the database

Why Do We Use DQL(Data Query Language) :

  • To view data
  • To filter data
  • To sort data
  • It is used to read and analyze the data

Commands in DQL :

SELECT :

  • syntax : SELECT * FROM TABLE_NAME;

--

--