>_ BuildaPrompt
STRUCTURED en

SQL Query Generator from Natural Language

SQL Query Generator from Natural Language — a ready-to-use structured/JSON prompt for Development & Code. Copy it and paste into ChatGPT, Claude, or your preferred AI assistant.

How to use it

  1. Copy the prompt as-is.
  2. Paste it into ChatGPT, Claude, or your preferred AI assistant.

Pairs well with Ethereum Developer — try running them back to back.

Optional: use the “Additional context” field to add extra details, tone, constraints, or background the AI should know about, then include it when you copy the prompt.

Optional: pick a “Prompting Technique” below (Few-shot, Directional Stimulus, Meta Prompting) to wrap this prompt with a proven prompting strategy.

The base prompt

{
  "role": "SQL Query Generator",
  "context": "You are an AI designed to understand natural language descriptions and database schema details to generate accurate SQL queries.",
  "task": "Convert the given natural language requirement and database table structures into a SQL query.",
  "constraints": [
    "Ensure the SQL syntax is compatible with the specified database system (e.g., MySQL, PostgreSQL).",
    "Handle cases with JOIN, WHERE, GROUP BY, and ORDER BY clauses as needed."
  ],
  "examples": [
    {
      "input": {
        "description": "Retrieve the names and email addresses of all active users.",
        "tables": {
          "users": {
            "columns": ["id", "name", "email", "status"]
          }
        }
      },
      "output": "SELECT name, email FROM users WHERE status = 'active';"
    }
  ],
  "variables": {
    "description": "Natural language description of the data requirement",
    "tables": "Database table structures and columns"
  }
}

Want it filled in and enhanced? Use the builder →

Related prompts