SQL Articles

All articles

LIKE in MySQL — How It Works

What the MySQL LIKE function does, with an example.

BETWEEN in MySQL — How It Works

What the MySQL BETWEEN function does, with an example.

IN in MySQL — How It Works

What the MySQL IN function does, with an example.

EXISTS in MySQL — How It Works

What the MySQL EXISTS function does, with an example.

OFFSET in MySQL — How It Works

What the MySQL OFFSET function does, with an example.

LIMIT in MySQL — How It Works

What the MySQL LIMIT function does, with an example.

DISTINCT in MySQL — How It Works

What the MySQL DISTINCT function does, with an example.

CASE WHEN in MySQL — How It Works

What the MySQL CASE WHEN function does, with an example.

IF() in MySQL — How It Works

What the MySQL IF() function does, with an example.

CONVERT() in MySQL — How It Works

What the MySQL CONVERT() function does, with an example.

CAST() in MySQL — How It Works

What the MySQL CAST() function does, with an example.

NULLIF() in MySQL — How It Works

What the MySQL NULLIF() function does, with an example.

IFNULL() in MySQL — How It Works

What the MySQL IFNULL() function does, with an example.

COALESCE() in MySQL — How It Works

What the MySQL COALESCE() function does, with an example.

RAND() in MySQL — How It Works

What the MySQL RAND() function does, with an example.

MOD() in MySQL — How It Works

What the MySQL MOD() function does, with an example.

ABS() in MySQL — How It Works

What the MySQL ABS() function does, with an example.

CEIL() in MySQL — How It Works

What the MySQL CEIL() function does, with an example.

FLOOR() in MySQL — How It Works

What the MySQL FLOOR() function does, with an example.

ROUND() in MySQL — How It Works

What the MySQL ROUND() function does, with an example.

GROUP_CONCAT() in MySQL — How It Works

What the MySQL GROUP_CONCAT() function does, with an example.

MAX() in MySQL — How It Works

What the MySQL MAX() function does, with an example.

MIN() in MySQL — How It Works

What the MySQL MIN() function does, with an example.

AVG() in MySQL — How It Works

What the MySQL AVG() function does, with an example.

SUM() in MySQL — How It Works

What the MySQL SUM() function does, with an example.

COUNT() in MySQL — How It Works

What the MySQL COUNT() function does, with an example.

TIMESTAMPDIFF() in MySQL — How It Works

What the MySQL TIMESTAMPDIFF() function does, with an example.

EXTRACT() in MySQL — How It Works

What the MySQL EXTRACT() function does, with an example.

DAYNAME() in MySQL — How It Works

What the MySQL DAYNAME() function does, with an example.

DAY() in MySQL — How It Works

What the MySQL DAY() function does, with an example.

MONTH() in MySQL — How It Works

What the MySQL MONTH() function does, with an example.

YEAR() in MySQL — How It Works

What the MySQL YEAR() function does, with an example.

STR_TO_DATE() in MySQL — How It Works

What the MySQL STR_TO_DATE() function does, with an example.

DATE_FORMAT() in MySQL — How It Works

What the MySQL DATE_FORMAT() function does, with an example.

DATEDIFF() in MySQL — How It Works

What the MySQL DATEDIFF() function does, with an example.

DATE_SUB() in MySQL — How It Works

What the MySQL DATE_SUB() function does, with an example.

DATE_ADD() in MySQL — How It Works

What the MySQL DATE_ADD() function does, with an example.

CURTIME() in MySQL — How It Works

What the MySQL CURTIME() function does, with an example.

CURDATE() in MySQL — How It Works

What the MySQL CURDATE() function does, with an example.

NOW() in MySQL — How It Works

What the MySQL NOW() function does, with an example.

REVERSE() in MySQL — How It Works

What the MySQL REVERSE() function does, with an example.

LOCATE() in MySQL — How It Works

What the MySQL LOCATE() function does, with an example.

RIGHT() in MySQL — How It Works

What the MySQL RIGHT() function does, with an example.

LEFT() in MySQL — How It Works

What the MySQL LEFT() function does, with an example.

REPLACE() in MySQL — How It Works

What the MySQL REPLACE() function does, with an example.

TRIM() in MySQL — How It Works

What the MySQL TRIM() function does, with an example.

LOWER() in MySQL — How It Works

What the MySQL LOWER() function does, with an example.

UPPER() in MySQL — How It Works

What the MySQL UPPER() function does, with an example.

LENGTH() in MySQL — How It Works

What the MySQL LENGTH() function does, with an example.

SUBSTRING() in MySQL — How It Works

What the MySQL SUBSTRING() function does, with an example.

CONCAT() in MySQL — How It Works

What the MySQL CONCAT() function does, with an example.

What Is a Database Migration?

A database migration is a version-controlled file describing an incremental change to a database schema, like creating a table or adding a column, that can b...

What Is an ORM (Object-Relational Mapping)?

An ORM lets you interact with a relational database using your programming language's objects and methods instead of writing raw SQL directly.

Soft Delete vs Hard Delete — What's the Difference?

A hard delete permanently removes a row from the database; a soft delete instead marks a row as deleted (typically with a deleted_at timestamp or is_deleted...

SQL vs NoSQL — What's the Difference?

SQL (relational) databases store structured data in tables with fixed schemas and enforce relationships via foreign keys; NoSQL databases store data in flexible formats like documents, key-value pairs, or graphs, typically without a fixed schema.

VARCHAR vs TEXT in MySQL — Which Should You Use?

VARCHAR stores variable-length strings up to a defined limit inline with the row; TEXT stores larger content, often off-page. Learn when to use each.

What Is Database Normalization? 1NF, 2NF, 3NF Explained

Database normalization organizes tables to reduce redundancy and avoid update anomalies. Learn the first three normal forms with simple examples.

TRUNCATE vs DELETE in SQL — What's the Difference?

DELETE removes rows one at a time and can be filtered and rolled back; TRUNCATE instantly empties a whole table and resets auto-increment counters.

UNION vs UNION ALL in SQL

UNION combines two query results and removes duplicate rows; UNION ALL combines them and keeps every row, which is significantly faster.

Primary Key vs Foreign Key in SQL

A primary key uniquely identifies each row in its own table; a foreign key references a primary key in another table to establish a relationship.

What Is a Database Index and How Does It Speed Up Queries?

A database index is a separate sorted data structure that lets the database find rows without scanning the whole table. Learn how indexes work and their tradeoffs.

WHERE vs HAVING in SQL — What's the Difference?

WHERE filters individual rows before grouping; HAVING filters groups after GROUP BY and aggregation. Learn when SQL requires each one.

SQL JOIN Types Explained: INNER, LEFT, RIGHT, and FULL

Understand the difference between INNER JOIN, LEFT JOIN, RIGHT JOIN, and FULL OUTER JOIN in SQL, with examples of what rows each one returns.