Search⌘ K
AI Features

Planning Multi-Step Queries

Explore how to break complex data questions into logical SQL steps, use AI to plan and scaffold multi-step queries with CTEs, and turn your query logic into clear, structured code for better analysis and debugging.

Step 1: Start with a real question

Let’s imagine a common data task: Find departments where the average employee salary is higher than the overall company average.

This question appears to be a single query, but it’s actually several steps in disguise.

Ask yourself:

  1. What’s the company's average salary?

  2. What’s the average per department?

  3. How do I compare them?

Each part can become its own query step, a building block for the final answer. ...

Powered by AI
5 Prompts Remaining
Prompt AI WidgetOur tool is designed to help you to understand concepts and ask any follow up questions. Ask a question to get started.

...