The prompt
Here is the schema for a database:
{schema}
Given this schema, can you output a SQL query to answer the following question? Only output the SQL query and nothing else. Do not wrap it in a code block.
Question: {query} What it is
Gives the model a database schema and a question in plain language, and asks for only the SQL query with no code block around it. The source notebook runs the generated query against a small test database. The prompt text comes from the Anthropic claude-cookbooks repository (MIT licence, Copyright (c) 2023 Anthropic). Only the code indentation around it was removed. Original author: Anthropic (anthropics/claude-cookbooks).
Who it's for
- Analysts
- Developers
يعطي النموذج مخطط قاعدة البيانات وسؤالًا بلغة عادية، ويطلب استعلام SQL فقط من دون أي نص إضافي.
Examples
Question and output from the notebook
PromptWhat are the names and salaries of employees in the Engineering department?
SELECT name, salary
FROM EMPLOYEES
WHERE department = 'Engineering';Expected output: The sample question and the query printed in the source, against an EMPLOYEES table.