Collections
Datasets
Tools
CSV to SQL
JSON to SQL
Sign In
Name
Description
Combine recursive aggregation with window function ranking to create hierarchical reports. Calculate totals that include all descendants, rank siblings by their rolled-up metrics, and maintain tree order. Works for budgets, traffic reports, sales territories, and more.
Database
PostgreSQL
MySQL
MariaDB
Oracle
Cancel
Save
Use desktop for interactive SQL sandbox
Settings
Fork this book
Notes
SQL
MySQL - 8.0
Oracle - 21.3.0
PostgreSQL - 17
ERD
Run Code
Read-only book
Fork to Edit
Tip: Press
Alt
+
Enter
to run SQL
SQL Output
Clear
Getting Started
1
Switch to a SQL tab and select a database
2
Write or paste your SQL in the editor
3
Press
Alt
+
Enter
to run
Quick Templates
Show Tables
Basic SELECT
JOIN Example
Create Table
Tip:
Select text in the editor to run only that portion
Ranking Within Hierarchies-The Bottom-Up Rollup Pattern
Updated 2/1/26, 10:08 PM
Notes
SQL
Alt+Enter to run