SQL Introduction

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.

SQL syntax is standardized, but database products add their own features and differences. These tutorials focus mainly on MySQL.
SQL basics, sample student table and first SELECT query

Types of SQL Commands Top ↑

CategoryPurposeExamples
DDLDefine or change database objects.CREATE, ALTER, DROP, RENAME, TRUNCATE
DMLAdd, change or remove stored rows.INSERT, UPDATE, DELETE
DQLRetrieve data.SELECT
DCLControl privileges.GRANT, REVOKE
TCLControl transactions.COMMIT, ROLLBACK, SAVEPOINT

Core Querying Topics Top ↑

TopicWhat it teaches
SELECTRetrieve columns and rows.
WHEREFilter rows with conditions.
BETWEENFilter values within a range.
INMatch against a list of values.
LIKEWildcard text matching.
REGEXPRegular-expression matching.
ORDER BYSort result rows.
LIMITRestrict result-row count.
DISTINCTReturn unique result values.
GROUP BYGroup rows for summaries.
HAVINGFilter grouped results.
INNER JOINCombine matching rows from tables.
LEFT JOINKeep all rows from the left table.
UNIONCombine compatible result sets.
SubqueriesUse a query inside another query.
CASEConditional values in SQL.
NULLWork with missing or unknown values.

Useful Query Functions and Expressions

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.

Create a Sample Student Table Top ↑

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 Sample Rows Top ↑

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);

Recommended Learning Path Top ↑

  1. Install or access MySQL.
  2. Create/select a database.
  3. Understand tables and records.
  4. Create a table and choose data types.
  5. Insert data.
  6. Start retrieving data with SELECT, WHERE and ORDER BY.



Subscribe to our YouTube Channel here



plus2net.com




SQL Video Tutorials










✖
We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles Contact us
© 2000-2026 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer