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.

100
Duration
4s
Input Tokens
953
Output Tokens
163
Cost
$0.00
Context
Input
Show customer names and the number of service records (as service_count) for their vehicles ordered alphabetically, only customers with service records (not 0)
Expected output
SELECT c.name, COUNT(*) AS service_count FROM customers c JOIN sales s ON c.customer_id = s.customer_id JOIN service_records sr ON s.vehicle_id = sr.vehicle_id GROUP BY c.name ORDER BY c.name;
Model output
SELECT customers.name, COUNT(service_records.record_id) as service_count FROM customers JOIN sales ON customers.customer_id = sales.customer_id JOIN service_records ON sales.vehicle_id = service_records.vehicle_id GROUP BY customers.name HAVING COUNT(service_records.record_id) > 0 ORDER BY customers.name;