Back to blog home

Take your SQL from Good to Great: Part 1

Written by The Count Team

AutomationTransparency & auditability

Discover SQL hacks to elevate your skills! Part 1 explores Common Table Expressions for clearer, faster, and more reliable queries. Perfect for quick iterations and trustworthy validations.

Last week I saw atweetthat got me thinking: what are the SQL ‘hacks’ I would go back and teach myself sooner if I could? This simple question quickly turned into a series of articles that expounds on some of my favorite methods explaining both why they’re useful, and how to use them. The topics I’ve selected are:

Part 1: Common Table Expressions

Part 2: All about those dates

Part 3: The other JOINs

Part 4: Window Functions

Part 5: User-Defined Functions

A complex canvas
A complex canvas

What’s a CTE?

Common Table Expressions (CTEs) are temporary tables that are available in a single query. They use the following syntax: