SQL

Natural language to SQL query generation evaluates text-to-query fidelity and schema reasoning. This task is particularly relevant for analytics chat assistants and simplified database interfaces where users need to query data using natural language. Models must understand both the intent behind the question and the structure of the underlying database schema.

75
Duration
5s
Input Tokens
834
Output Tokens
149
Cost
$0.00
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.sale_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;