Input Tokens
23751
Output Tokens
3049
Duration
241086.513
Cost
0
Context
Input
List the names of employees and how many vehicles each of them has sold, including employees with 0 sales.
Expected output
SELECT e.name, COUNT(s.sale_id) AS vehicles_sold FROM employees e LEFT JOIN sales s ON e.employee_id = s.employee_id GROUP BY e.name ORDER BY e.name;
Model output
SELECT e.name, COUNT(s.vehicle_id) AS vehicles_sold FROM employees e LEFT JOIN sales s ON e.employee_id = s.employee_id GROUP BY e.employee_id, e.name ORDER BY vehicles_sold DESC;