Natural Language to SQL for Fixed Schema

Anthropic prompt library

Submit a prompt

Overview

Translate an analytics request into SQL using only the provided customers, orders, and related tables.

Use cases

Prompt
Copied 0
Transform the following natural language request into a valid SQL query. Assume a database with these tables:

Customers: customer_id (INT PK), first_name, last_name, email, phone, address, city, state, zip_code
Products: product_id (INT PK), product_name, description, category, price, stock_quantity
Orders: order_id (INT PK), customer_id (FK), order_date, total_amount, status
Order_Items: order_item_id (INT PK), order_id (FK), product_id (FK), quantity, price
Reviews: review_id (INT PK), product_id (FK), customer_id (FK), rating, comment, review_date
Employees: employee_id (INT PK), first_name, last_name, email, phone, hire_date, job_title, department, salary

Provide only the SQL query that retrieves the data based on the request. Do not invent tables or columns.

REQUEST:
<<<paste natural language request>>>

Can AI?

Alternatives