Skip to content
← SQL Tools
🔒 Runs in your browser 🚫 No data uploaded ✓ Free, no login

SQL Patterns

Common SQL Server query patterns — parameterized and ready to run. Fill in your table details and get production-ready T-SQL for recurring data engineering tasks.

📅
Date Spine Generator
Generate a continuous date series — daily, weekly, monthly, or quarterly. Includes LEFT JOIN template to fill reporting gaps.
Open tool →
🧹
Deduplication Generator
Remove duplicate rows using ROW_NUMBER(). Choose which row to keep, preview before deleting, fast pattern for large tables.
Open tool →

What Are SQL Patterns?

SQL patterns are reusable query templates that solve recurring data engineering problems. Instead of writing the same boilerplate ROW_NUMBER() or recursive CTE from scratch each time, these generators let you fill in your table and column names and get production-ready T-SQL instantly.

Each pattern follows SQL Server best practices — using CTEs for readability, window functions for efficiency, and including a preview step so you can validate results before modifying data.

When to Use Each Pattern

The Date Spine Generator is essential for time-series reporting. If your data has gaps — missing days, weeks, or months where no records exist — a date spine provides the continuous axis you need for accurate aggregation. It generates a complete date series and a LEFT JOIN template that fills gaps with zeros or nulls.

The Deduplication Generator handles one of the most common data quality issues: duplicate rows. It uses ROW_NUMBER() OVER (PARTITION BY ...) to identify duplicates and lets you choose which row to keep based on a tie-breaking column such as a timestamp or ID. The generated query always includes a SELECT preview before any DELETE, so you can verify what will be removed.

Related SQL Tools

Frequently Asked Questions

What SQL dialect do these patterns generate?
All patterns currently generate T-SQL (SQL Server syntax). This includes features like ROW_NUMBER(), CTEs, and CROSS JOIN with values lists. PostgreSQL and MySQL versions are planned for future releases.
Can I use the generated SQL in production?
Yes. The generated queries follow SQL Server best practices. The deduplication pattern always includes a preview SELECT before any DELETE, so you can verify what will be removed. Always test in a non-production environment first.
How does the date spine work?
The date spine generator creates a continuous series of dates using a recursive CTE. You specify the start date, end date, and interval (daily, weekly, monthly, or quarterly). It also generates a LEFT JOIN template so you can join your data against the spine and fill gaps with zeros.
Does any data leave my browser?
No. All query generation happens entirely in your browser. No table names, column names, or other data is transmitted anywhere.