SQL (Structured Query Language) is used to define database structures, add and change data, retrieve rows, control access, and manage transactions. You can learn the commands progressively rather than memorizing everything at once.
SELECT id, name, mark
FROM student
WHERE mark > 60
ORDER BY mark DESC;
This query reads selected columns from the student table, keeps rows with marks above 60, and sorts the result from highest to lowest mark.
| Category | Purpose | Examples |
|---|---|---|
| DDL | Define or change database objects. | CREATE, ALTER, DROP, RENAME, TRUNCATE |
| DML | Add, change or remove stored rows. | INSERT, UPDATE, DELETE |
| DQL | Retrieve data. | SELECT |
| DCL | Control privileges. | GRANT, REVOKE |
| TCL | Control transactions. | COMMIT, ROLLBACK, SAVEPOINT |
| Topic | What it teaches |
|---|---|
| SELECT | Retrieve columns and rows. |
| WHERE | Filter rows with conditions. |
| BETWEEN | Filter values within a range. |
| IN | Match against a list of values. |
| LIKE | Wildcard text matching. |
| REGEXP | Regular-expression matching. |
| ORDER BY | Sort result rows. |
| LIMIT | Restrict result-row count. |
| DISTINCT | Return unique result values. |
| GROUP BY | Group rows for summaries. |
| HAVING | Filter grouped results. |
| INNER JOIN | Combine matching rows from tables. |
| LEFT JOIN | Keep all rows from the left table. |
| UNION | Combine compatible result sets. |
| Subqueries | Use a query inside another query. |
| CASE | Conditional values in SQL. |
| NULL | Work with missing or unknown values. |
As you progress, these tutorials extend the core query commands: COUNT(), MAX(), GROUP_CONCAT(), CONCAT(), REPLACE(), IF(), IS, AND / OR, LOCATE(), RAND(), and window functions with OVER().
You can manage the server through tools covered in MySQL front-end tools.
The tutorials commonly use a small student table. This modern definition uses InnoDB, a primary key and utf8mb4.
CREATE TABLE student (
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
name VARCHAR(50) NOT NULL,
class VARCHAR(20) NOT NULL,
mark TINYINT UNSIGNED NOT NULL DEFAULT 0,
PRIMARY KEY (id)
) ENGINE=InnoDB
DEFAULT CHARSET=utf8mb4;
For a deeper explanation of columns, datatypes and constraints, continue to Tables & Records, Data Types and Primary Keys.
INSERT INTO student (id, name, class, mark) VALUES
(1, 'John Deo', 'Four', 75),
(2, 'Max Ruin', 'Three', 85),
(3, 'Arnold', 'Three', 55),
(4, 'Krish Star', 'Four', 60),
(5, 'John Mike', 'Four', 60),
(6, 'Alex John', 'Five', 55);
Author & Instructor at plus2net
I write and maintain practical tutorials on Python, PHP, SQL, JavaScript, HTML, jQuery, and web development at plus2net. The tutorials focus on clear explanations, working examples, and code that readers can test and adapt while learning.