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.

0
Duration
4s
Input Tokens
937
Output Tokens
144
Cost
$0.00
Context
Input
Find the name of the dealership that has the highest total revenue from vehicle sales
Expected output
SELECT d.name FROM dealerships d JOIN sales s ON d.branch_id = s.branch_id GROUP BY d.name ORDER BY SUM(s.sale_price) DESC LIMIT 1;
Model output
SELECT dealerships.name FROM dealerships JOIN (SELECT customers.name AS dealership, SUM(sales.sale_price) AS total_revenue FROM sales JOIN customers ON sales.customer_id = customers.customer_id GROUP BY customers.name) AS revenue ON dealerships.name = revenue.dealership ORDER BY total_revenue DESC LIMIT 1