Converts plain-language data questions into structured SQL using CTEs, null-safe logic, and readable column aliases.
Converts plain-language data questions into structured SQL using CTEs, null-safe logic, and readable column aliases. Use it when you want queries that run clean and stay readable for anyone who didn't write them.
Write a SQL query for this analysis: Database: {{PostgreSQL / MySQL / BigQuery / Snowflake / etc.}} Tables available: {{list each table with its columns and relationships / foreign keys}} What I need: {{describe the analysis in plain language — e.g., "Monthly revenue by product category for the last 12 months, compared to the same month in the prior year, showing the year-over-year growth rate, excluding refunded orders"}} Requirements: - Handle nulls appropriately - Use CTEs for readability if the query is complex - Include comments explaining non-obvious logic - Optimize for {{large tables — millions of rows / small tables — fine to be readable over fast}} - Output column names should be business-friendly (not database_column_names)
Source: https://sureprompts.com/blog/ai-prompts-for-data-analysis