SQL Articles
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.