// articles · learn & grow

SQL Articles & Tutorials

Expert-written tutorials, guides, and deep dives into SQL — from basics to advanced optimization. Direct answers, examples, and FAQs.

// LATEST ARTICLES37 ARTICLES

Market Basket Analysis SQL Interview Explained
Interview Questions★ Featured

Market Basket Analysis SQL Interview Explained

This is the retail and e-commerce interview classic: find product pairs frequently bought together. One line of self-join logic makes or breaks the answer.

SqlInt team2 min read
Year-over-Year Growth SQL Interview Walkthrough
Interview Questions2 min read

Year-over-Year Growth SQL Interview Walkthrough

YoY growth questions test whether a candidate reaches for LAG or a clunky self-join, and whether they remember to guard against divide-by-zero. A full walkthrough with both engines.

SqlInt team2 min read
User Retention SQL Interview Question: Month-1 Retention
Interview Questions2 min read

User Retention SQL Interview Question: Month-1 Retention

Retention questions are a growth team staple in SQL interviews. This walks through the exact query, the schema, and the integer division bug that quietly wrecks an otherwise correct solution.

SqlInt team2 min read
SQL Window Functions: Rolling Averages Interview
Interview Questions2 min read

SQL Window Functions: Rolling Averages Interview

Window functions are the single most common topic in SQL interviews that separates candidates who understand real analytics from those who only know basic SELECT statements. Here is the exact rolling average question interviewers ask, solved in SQLite and PostgreSQL.

SqlInt team2 min read
The Ultimate SQL Cheat Sheet
Reference2 min read

The Ultimate SQL Cheat Sheet

A single-page SQL reference covering JOINs, window functions, CTEs, NULL handling, CASE WHEN, string/date functions, constraints, common query patterns, and more.

SqlInt team2 min read
SQL Injection: How It Works and How to Prevent It
Best Practices2 min read

SQL Injection: How It Works and How to Prevent It

Learn how SQL injection attacks actually work — authentication bypass, UNION-based data exfiltration — and how parameterized queries prevent them structurally.

SqlInt team2 min read
Idempotent SQL: Writing Safe, Re-runnable Scripts
Best Practices2 min read

Idempotent SQL: Writing Safe, Re-runnable Scripts

Learn to write idempotent SQL for migrations, seed scripts, and ETL jobs — safe upserts, guarded schema changes, and the relative-update trap that compounds on re-run.

SqlInt team2 min read
RFM Analysis and Customer Segmentation in SQL
Product Analytics2 min read

RFM Analysis and Customer Segmentation in SQL

Learn to build Recency, Frequency, Monetary (RFM) customer segmentation in SQL using NTILE, including the recency-inversion gotcha and segment-level reporting.

SqlInt team2 min read
A/B Test Analysis with SQL
Product Analytics2 min read

A/B Test Analysis with SQL

Learn to analyze A/B tests in SQL — conversion rate by variant, sample ratio mismatch checks, a two-proportion z-test, and common statistical pitfalls like peeking.

SqlInt team2 min read
CTE vs Subquery vs Temp Table vs View: When to Use Each
Fundamentals2 min read

CTE vs Subquery vs Temp Table vs View: When to Use Each

A practical decision framework for choosing between a CTE, subquery, temp table, view, or materialized view in SQL, with a comparison table and real tradeoffs.

SqlInt team2 min read

// FAQ

SQL Articles — FAQ

What SQL topics do the articles cover?

Interview prep, query patterns, window functions and CTEs, performance and optimization, fundamentals, and best practices — from beginner SELECT queries to advanced grouping, joins, and subqueries.

Are the SQL articles free?

Yes. All published articles on SqlInt are free to read with no signup required, and most include a free PDF download.

Can I download articles as PDF?

Yes. Every article page has a Download PDF button that generates a printable PDF with working links — including the free SQL cheat sheet.

How often are new articles published?

New tutorials and guides are added regularly. Subscribe via the RSS feed at sqlint.com/rss.xml to get new articles as they publish.

Where should beginners start?

Start with the Beginner and Fundamentals categories, then move to Interview Prep and Query Pattern articles once you can write basic SELECT, WHERE, GROUP BY, and JOIN queries.