SQL Query Foundations
Created by CodeCraft LLCWrite correct, readable SQL from scratch
Product and technology names are trademarks of their respective owners, used only to identify what this skill covers. CodeCraft LLC is not affiliated with or endorsed by them.
by Jace (@jamick)v1.4.2 · updated 2026-12-01Report copyright infringement
Description
Write correct, readable SQL from scratch - SELECT and projection, WHERE filtering (comparisons, BETWEEN, IN, LIKE, IS NULL), NULL semantics, ORDER BY, GROUP BY and HAVING with aggregates, every join type and when each is correct, subqueries (scalar, IN, EXISTS), CTEs, UNION/INTERSECT/EXCEPT, OFFSET vs keyset pagination, and INSERT/UPDATE/DELETE with RETURNING. Use whenever the user is learning SQL or writing first queries, asks what a JOIN does, hits a GROUP BY error, combines result sets, is confused by NULL, paginates results, or gets unexpected, missing or duplicated rows.
Free for everyone with an account
Official and free skills are included with the all-access subscription
Changelog
Subscribers also see which files changed in each version.
v1.4.2Dec 1, 2026Latest
Added
- README: a **Sources** line listing the official pages the skill is written from, each link checked, so the source-overlap check can run against them.
v1.4.1Nov 29, 2026
Changed
- Added a contents list to reference files over 100 lines (
query-building-blocks.md), so a partial read still shows every section.
v1.4.0Nov 29, 2026
Fixed
- The
RETURNINGexample decremented stock with no guard, so concurrent buyers could take it negative; it now guardsstock > 0in the same statement.
Added
- Upserts (
ON CONFLICT),MERGE(15+) withRETURNING merge_action()(17+),RETURNING old/new(18+) - all run on PostgreSQL 18; PostgreSQL 19standard_conforming_stringspitfall (logged PG19 follow-up applied); task rows, pitfalls and a checklist item.
Changed
- Deep-dive section made on-demand with open/skip triggers.
v1.3.0Nov 20, 2026
Added
- Review method: every code review starts by mapping the code flows in scope and gives each flow its own sub-agent at high effort, which reviews that flow end to end against this checklist; the main agent merges, re-checks Blockers and de-duplicates. Covers single-flow reviews, nested sub-agents, failed sub-agents and environments without sub-agents.
v1.2.0Nov 6, 2026
Changed
- Review report rule: reviews that cover changes (a diff, PR or uncommitted work) open with a short "What the changes do" section - factual bullets grouped by purpose, inferred intent marked, deploy or migration impact stated.
v1.1.0Nov 4, 2026
Changed
- Review report rule at the top of the skill, loaded before any review: one entry per finding as
Level · type · file:line · finding · proposed fix, outside facts sourced or marked unverified, and no narrative.
v1.0.0Oct 16, 2026
Added
- First release.