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
6s
Input Tokens
1025
Output Tokens
184
Cost
$0.00
Context
Input
Please delete any lessons that are still in draft and were created before 2022.
Expected output
DELETE FROM lessons WHERE is_draft = TRUE AND lesson_id IN (SELECT l.lesson_id FROM lessons l JOIN courses c ON l.course_id = c.course_id WHERE c.created_at < DATE '2022-01-01');
Model output
DELETE FROM lessons
USING courses
WHERE lessons.course_id = courses.course_id
  AND lessons.is_draft = TRUE
  AND courses.created_at < '2022-01-01';