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
16s
Input Tokens
848
Output Tokens
1386
Cost
$0.00
Context
Input
Between May and September 2025, how many Volvo vehicles were sold during the first week of each month, grouped by dealership?
Expected output
WITH filtered_sales AS ( SELECT s.*, v.make, d.name AS dealership_name FROM sales s JOIN vehicles v ON s.vehicle_id = v.vehicle_id JOIN dealerships d ON s.branch_id = d.branch_id WHERE v.make = 'Volvo' AND s.sale_date >= DATE '2025-05-01' AND s.sale_date < DATE '2025-10-01' AND EXTRACT(DAY FROM s.sale_date) <= 7 ) SELECT dealership_name, DATE_TRUNC('month', sale_date) AS month, COUNT(*) AS volvo_sales FROM filtered_sales GROUP BY dealership_name, DATE_TRUNC('month', sale_date) ORDER BY month, dealership_name;
Model output
SELECT
    d.name AS dealership_name,
    TO_CHAR(s.sale_date, 'YYYY-MM') AS sale_month,
    COUNT(s.sale_id) AS number_of_volvos_sold
FROM
    sales AS s
JOIN
    vehicles AS v ON s.vehicle_id = v.vehicle_id
JOIN
    dealerships AS d ON s.branch_id = d.branch_id
WHERE
    v.make = 'Volvo'
    AND s.sale_date >= '2025-05-01' AND s.sale_date < '2025-10-01'
    AND EXTRACT(DAY FROM s.sale_date) <= 7
GROUP BY
    d.name,
    sale_month
ORDER BY
    dealership_name,
    sale_month;