Notes
Short explanations for the situations you meet at work.
Database Normalization: Normal Forms Explained Simply
What database normalization is and why it matters: the first, second and third normal forms explained on one example, data anomalies, and the cases where denormalization is justified
ROW_NUMBER vs RANK vs DENSE_RANK in SQL: The Difference in One Example
How ROW_NUMBER, RANK and DENSE_RANK differ: one query with duplicate values shows it all. We solve top-N per group and deduplication, add NTILE as a bonus and the classic second-highest-salary interview task
ACID: The 4 Properties of Database Transactions Explained Simply
What ACID means in databases: atomicity, consistency, isolation and durability explained with everyday examples, isolation levels, read anomalies and common interview questions
SQL COALESCE: What It Is and How It Works
The COALESCE function returns the first non-NULL argument in its list. We cover the syntax, live examples on a real database, the differences from IFNULL, ISNULL and NVL, and the NULLIF combo
CTE in SQL: What a Common Table Expression (WITH) Is
A CTE (Common Table Expression) is a named temporary query result declared with WITH. We cover the syntax, multiple CTEs in one query, recursive CTEs for hierarchies and the performance implications
DATEDIFF in SQL: How to Calculate the Difference Between Dates (MySQL, PostgreSQL)
How to calculate the difference between dates in SQL: DATEDIFF in MySQL and SQL Server (with different argument orders), date subtraction, AGE and EXTRACT(EPOCH) in PostgreSQL, age from a birth date and a cross-DBMS cheat sheet
SQL from Scratch: A Step-by-Step Learning Plan for Beginners in 2026
How to learn SQL from scratch: a realistic week-by-week roadmap with links to free lessons, how long it takes, where to practice and which mistakes slow beginners down
PIVOT in SQL: How to Turn Rows into Columns
How to turn rows into columns using CASE+GROUP BY and FILTER. Step-by-step examples on a real database
SQL Query Optimization: 10 Ways to Speed Up a Slow Query
Practical SQL query optimization techniques: reading the plan with EXPLAIN, indexes and the reasons they stop working, SARGable conditions, the LIKE and OFFSET traps, EXISTS vs IN and fighting N+1
SQL SEQUENCE in PostgreSQL: one ID generator for multiple tables
Need shared numbering for invoices and delivery notes, but SERIAL creates duplicates across different tables? SEQUENCE solves this elegantly. We will explore real scenarios, gotchas (number gaps!), and explain why in 90% of cases simple SERIAL is all you need ✨
SQL String Functions: CONCAT, SUBSTRING, TRIM, REPLACE
A cheat sheet for SQL string functions: concatenation (CONCAT, CONCAT_WS, GROUP_CONCAT, STRING_AGG), extracting substrings (SUBSTRING, LEFT), cleaning (TRIM, REPLACE), case handling, search, and a MySQL vs PostgreSQL difference table
TRUNCATE vs DELETE vs DROP in SQL: The Difference and What to Choose
DELETE removes rows by condition, TRUNCATE instantly empties a table, DROP removes the whole table. We compare speed, rollback, triggers, AUTO_INCREMENT counters and behavior with foreign keys
SQL for Data Analysts: Skills, Example Tasks and a Study Plan
SQL for data analysts: the five skills you use weekly, a top-N-per-category example, and a 4-6 week study plan with hands-on practice.
Data Jobs That Use SQL in Thailand: Roles and Preparation
Which data roles in Thailand use SQL, how deep each one goes, what employers look for, and how to prepare for the SQL interview.