Window functions
Running totals, ranks, and more.
chatgptgemini
Act as a SQL expert. I need [running total / rank / moving average / row number per group] over [data]. Write the window-function query for [database], explain the PARTITION BY and ORDER BY choices, and show a small before/after example. Note performance considerations.
How to use this prompt
- Tap Copy prompt above.
- Replace the [bracketed] parts with your own details.
- Paste it into chatgpt, gemini.