Loading...
    • Developer Guide
    • API Reference
    • MCP
    • Resources
    • Release Notes
    Search...
    ⌘K

    Resources

    overviewGlossarySystem Prompts

    Use cases

    OverviewTicket routingCustomer support agentContent moderationLegal summarization

    Prompt Library

    Prompt LibraryCosmic KeystrokesCorporate clairvoyantWebsite wizardExcel formula expertGoogle apps scripterPython bug busterTime travel consultantStorytelling sidekickCite your sourcesSQL sorcererDream interpreterPun-ditCulinary creatorPortmanteau poetHal the humorous helperLaTeX legendMood colorizerGit gudSimile savantEthical dilemma navigatorMeeting scribeIdiom illuminatorCode consultantFunction fabricatorNeologism creatorCSV converterEmoji encoderProse polisherPerspectives pondererTrivia generatorMindfulness mentorSecond-grade simplifierVR fitness innovatorPII purifierMemo maestroCareer coachGrading guruTongue twisterInterview question crafterGrammar genieRiddle me thisCode clarifierAlien anthropologistData organizerBrand builderEfficiency estimatorReview classifierDirection decoderMotivational museEmail extractorMaster moderatorLesson plannerSocratic sageAlliteration alchemistFuturistic fashion advisorPolyglot superpowersProduct naming proPhilosophical musingsSpreadsheet sorcererSci-fi scenario simulatorAdaptive editorBabel's broadcastsTweet tone detectorAirport code analyst
    Console
    Prompt Library

    SQL sorcerer

    Transform everyday language into SQL queries.

    Copy this prompt into our developer Console to try it for yourself!

    Content
    SystemTransform the following natural language requests into valid SQL queries. Assume a database with the following tables and columns exists:

    Customers:
    - customer_id (INT, PRIMARY KEY)
    - first_name (VARCHAR)
    - last_name (VARCHAR)
    - email (VARCHAR)
    - phone (VARCHAR)
    - address (VARCHAR)
    - city (VARCHAR)
    - state (VARCHAR)
    - zip_code (VARCHAR)

    Products:
    - product_id (INT, PRIMARY KEY)
    - product_name (VARCHAR)
    - description (TEXT)
    - category (VARCHAR)
    - price (DECIMAL)
    - stock_quantity (INT)

    Orders:
    - order_id (INT, PRIMARY KEY)
    - customer_id (INT, FOREIGN KEY REFERENCES Customers)
    - order_date (DATE)
    - total_amount (DECIMAL)
    - status (VARCHAR)

    Order_Items:
    - order_item_id (INT, PRIMARY KEY)
    - order_id (INT, FOREIGN KEY REFERENCES Orders)
    - product_id (INT, FOREIGN KEY REFERENCES Products)
    - quantity (INT)
    - price (DECIMAL)

    Reviews:
    - review_id (INT, PRIMARY KEY)
    - product_id (INT, FOREIGN KEY REFERENCES Products)
    - customer_id (INT, FOREIGN KEY REFERENCES Customers)
    - rating (INT)
    - comment (TEXT)
    - review_date (DATE)

    Employees:
    - employee_id (INT, PRIMARY KEY)
    - first_name (VARCHAR)
    - last_name (VARCHAR)
    - email (VARCHAR)
    - phone (VARCHAR)
    - hire_date (DATE)
    - job_title (VARCHAR)
    - department (VARCHAR)
    - salary (DECIMAL)

    Provide the SQL query that would retrieve the data based on the natural language request.
    UserGet the list of customers who have placed orders but have not provided any reviews, along with the total amount they have spent on orders.

    Example output

    SELECT c.first_name, c.last_name, SUM(o.total_amount) AS total_spent
    FROM Customers c
    INNER JOIN Orders o ON c.customer_id = o.customer_id
    LEFT JOIN Reviews r ON c.customer_id = r.customer_id
    WHERE r.review_id IS NULL
    GROUP BY c.customer_id, c.first_name, c.last_name;
    

    API Request


    • Example output
    • API Request
    © 2025 ANTHROPIC PBC

    Products

    • Claude
    • Claude Code
    • Max plan
    • Team plan
    • Enterprise plan
    • Download app
    • Pricing
    • Log in

    Features

    • Claude and Slack
    • Claude in Excel

    Models

    • Opus
    • Sonnet
    • Haiku

    Solutions

    • AI agents
    • Code modernization
    • Coding
    • Customer support
    • Education
    • Financial services
    • Government
    • Life sciences

    Claude Developer Platform

    • Overview
    • Developer docs
    • Pricing
    • Amazon Bedrock
    • Google Cloud’s Vertex AI
    • Console login

    Learn

    • Blog
    • Catalog
    • Courses
    • Connectors
    • Customer stories
    • Engineering at Anthropic
    • Events
    • Powered by Claude
    • Service partners
    • Startups program

    Company

    • Anthropic
    • Careers
    • Economic Futures
    • Research
    • News
    • Responsible Scaling Policy
    • Security and compliance
    • Transparency

    Help and security

    • Availability
    • Status
    • Support center

    Terms and policies

    • Privacy policy
    • Responsible disclosure policy
    • Terms of service: Commercial
    • Terms of service: Consumer
    • Usage policy

    Products

    • Claude
    • Claude Code
    • Max plan
    • Team plan
    • Enterprise plan
    • Download app
    • Pricing
    • Log in

    Features

    • Claude and Slack
    • Claude in Excel

    Models

    • Opus
    • Sonnet
    • Haiku

    Solutions

    • AI agents
    • Code modernization
    • Coding
    • Customer support
    • Education
    • Financial services
    • Government
    • Life sciences

    Claude Developer Platform

    • Overview
    • Developer docs
    • Pricing
    • Amazon Bedrock
    • Google Cloud’s Vertex AI
    • Console login

    Learn

    • Blog
    • Catalog
    • Courses
    • Connectors
    • Customer stories
    • Engineering at Anthropic
    • Events
    • Powered by Claude
    • Service partners
    • Startups program

    Company

    • Anthropic
    • Careers
    • Economic Futures
    • Research
    • News
    • Responsible Scaling Policy
    • Security and compliance
    • Transparency

    Help and security

    • Availability
    • Status
    • Support center

    Terms and policies

    • Privacy policy
    • Responsible disclosure policy
    • Terms of service: Commercial
    • Terms of service: Consumer
    • Usage policy
    © 2025 ANTHROPIC PBC