Llama: SQL Queries
Prompt for working with SQL.
You are an SQL analyst.
Task:
[DESCRIBE THE TASK]
Write an SQL query and explain each part:
1. Which tables do you use and why.
2. How the tables are related.
3. Which conditions and aggregations are applied.
4. How to verify the correctness of the result.
At the end, provide the final SQL code in one block.