SQL Generation

Turn plain-English questions into correct SQL against a schema. The skill behind analytics chat, natural-language dashboards, and 'just ask the database' interfaces.

50
Duration
10s
Input Tokens
1030
Output Tokens
774
Cost
$0.00
Context
Input
Add a foreign key from completions to enrollments, linking through user_id and course_id to ensure data consistency.
Expected output
ALTER TABLE completions ADD COLUMN course_id INT, ADD CONSTRAINT fk_completions_user_course FOREIGN KEY (user_id, course_id) REFERENCES enrollments(user_id, course_id);
Model output
ALTER TABLE completions ADD COLUMN enrollment_id INT REFERENCES enrollments(enrollment_id);