Duration
4s
Input Tokens
755
Output Tokens
445
Cost
$0.00
Context
Input
Show the top 10 customers who bought the most vehicles. List their names and how many vehicles they purchased (vehicles_purchased).
Expected output
SELECT c.name, COUNT(*) AS vehicles_purchased FROM sales s JOIN customers c ON s.customer_id = c.customer_id GROUP BY c.name ORDER BY vehicles_purchased DESC LIMIT 10;
Model output
SELECT T1.name, COUNT(T2.vehicle_id) AS vehicles_purchased FROM customers AS T1 INNER JOIN sales AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.name ORDER BY vehicles_purchased DESC LIMIT 10