SyntaxStudy
Sign Up
Home MySQL Reference

MySQL Reference

18 entries — click any item for full details and examples

DML Statements

Name Description
SELECT Retrieves rows from one or more tables. The most frequently used SQL statement.
INSERT Inserts new rows into a table. Can insert single or multiple rows in one statement.
UPDATE Modifies existing rows in a table. Always use WHERE to avoid updating all rows.
DELETE Removes rows from a table. Always include WHERE unless you intend to delete all rows.
JOIN Combines rows from two or more tables. INNER returns matching rows; LEFT returns all left rows.

DDL Statements

Name Description
CREATE TABLE Creates a new table in the database with defined columns, data types, and constraints.
ALTER TABLE Modifies an existing table structure: add/drop columns, change data types, add indexes.
CREATE INDEX Creates an index on a table column to speed up query performance.

Clauses & Keywords

Name Description
WHERE Filters rows based on one or more conditions. Supports comparison, logical, LIKE, IN, BETWEEN, IS NULL.
GROUP BY / HAVING GROUP BY groups rows by column values; HAVING filters the grouped results (like WHERE for aggregates).
ORDER BY / LIMIT / OFFSET ORDER BY sorts results; LIMIT restricts the number of rows; OFFSET skips rows for pagination.
Subqueries A query nested inside another query. Can be used in SELECT, FROM, WHERE, and HAVING clauses.
UNION / UNION ALL Combines result sets of two or more SELECT statements. UNION removes duplicates; UNION ALL keeps them.

Functions

Name Description
Aggregate Functions Aggregate functions compute a single result from multiple rows. Used with GROUP BY for grouped summaries.
String Functions Built-in MySQL string manipulation functions for transforming and extracting string data.
Date Functions Built-in functions for working with date and time values in MySQL.
CASE WHEN Conditional expression similar to if-else. Can be used in SELECT, WHERE, ORDER BY, and UPDATE.
COALESCE() / IFNULL() COALESCE returns the first non-NULL value; IFNULL returns alt if expr is NULL.