Learn SQL and Databases the Easy Way
Plain-English guides to SQL, SQL Server performance, database design, data analysis and Delphi, written by a developer who works with databases every day. No jargon, lots of real examples.
Where Do You Want to Start?
New to SQL
Write your first queries and learn to filter, sort and summarise data.
Designing a Database
Build tables that keep your data clean, consistent and easy to query.
Going Further
Speed up queries, protect your data and write smarter SQL.
My Queries Are Slow
Find out why SQL Server is slow and fix it step by step.
Delphi + SQL Server
Build fast business apps in Delphi that work with SQL Server.
SQL for Data Analysis
Clean, summarise and report on your data with SQL.
Latest Articles
- Month-over-Month and Year-over-Year Comparisons in SQL (With LAG)
How to compare this month with last month and with the same month last year in SQL: LAG for month-over-month, a safe date join for year-over-year, year-to-date totals, and the missing-month trap. - Delphi Exception Handling: try..except, try..finally and raise Explained Simply
Delphi exception handling explained: try..except vs try..finally, catching specific exceptions, raise and re-raise, custom exceptions, FireDAC errors. - Temp Tables vs Table Variables vs CTEs in SQL Server: Which One to Use?
Temp table, table variable or CTE? How each one really works in SQL Server, why table variables can get a 1-row estimate, why a CTE can run twice, and a simple rule for choosing. - Classes and Objects in Delphi: OOP for Beginners
OOP in Delphi for beginners: classes, objects, properties, constructors, try..finally with Free, inheritance, virtual methods and TObjectList. - Parameterised Queries in Delphi (FireDAC and ADO) Explained Simply
Use parameters in Delphi SQL queries with FireDAC and ADO: ParamByName, data types, NULLs, dates, LIKE, INSERT, and how they stop SQL injection. - PIVOT and UNPIVOT in SQL Server: Turn Rows into Columns (and Back)
How to turn rows into columns in SQL: conditional aggregation that works everywhere, the SQL Server PIVOT operator, dynamic pivot, and two ways to unpivot (without losing NULLs). - SQL Server Statistics: Why Outdated Stats Slow Your Queries (and How to Fix Them)
Why a query suddenly gets slow after a data load: how SQL Server statistics work, how to compare estimated and actual rows, check when stats were last updated, and keep them fresh. - Cohort and Retention Analysis in SQL (Step by Step)
Group customers by the month they first bought and track how many come back. Build a retention triangle in SQL Server and MySQL, step by step. - SQL vs Python (pandas) for Data Analysis: Which Should You Use?
The same analysis in SQL and pandas side by side, a cheat sheet that maps one to the other, where each is stronger, and how analysts use both together.