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
28s
Input Tokens
960
Output Tokens
976
Cost
$0.00
Context
Input
Which students joined this year and already finished a lesson?
Expected output
SELECT DISTINCT u.name FROM users u JOIN completions c ON u.user_id = c.user_id WHERE u.role = 'student' AND u.created_at >= DATE_TRUNC('year', CURRENT_DATE);
Model output
SELECT u.user_id, u.name, u.email, u.created_at
FROM users u
WHERE u.role = 'student'
  AND u.created_at >= date_trunc('year', CURRENT_DATE)
  AND u.created_at < date_trunc('year', CURRENT_DATE) + INTERVAL '1 year'
  AND EXISTS (
    SELECT 1
    FROM completions c
    WHERE c.user_id = u.user_id
  );