Joins & aggregations help

Get joins and GROUP BY right.

chatgptgemini
Act as a SQL tutor. Help me write a query that joins [tables] and aggregates [metric] by [dimension], with filters [conditions]. Explain which join type to use and why, how the GROUP BY works, and how to avoid double-counting. Give the query and a small worked example. Database: [db].

How to use this prompt

  1. Tap Copy prompt above.
  2. Replace the [bracketed] parts with your own details.
  3. Paste it into chatgpt, gemini.