Describe what data you need in plain English and get a working SQL query. Supports joins, aggregations, window functions, and CTEs.
Convert my data request into a SQL query. ## Database Context - **Database type**: [PostgreSQL / MySQL / SQLite / SQL Server / BigQuery] - **Table(s) involved**: ``` [Describe your tables and columns, or paste CREATE TABLE statements, or describe the schema in plain English] ``` ## What I Need [Describe in plain English what data you want to retrieve] Examples: - "Show me the top 10 customers by total order value in the last 90 days" - "Find all users who signed up but never made a purchase" - "Monthly revenue trend for the last 12 months, broken down by product category" - "Running total of sales per salesperson, ranked within each region" ## Additional Requirements - [ ] Include comments explaining each part of the query - [ ] Optimize for performance (suggest indexes if relevant) - [ ] Show the expected output format (example result table) - [ ] Provide alternative approaches if there are multiple ways ## Output 1. The SQL query (formatted and commented) 2. Explanation of what each part does 3. Expected output format 4. Performance notes (if query is complex) 5. Common modifications (how to adjust the query for different needs)
No gallery images yet.