SQL Query Builder
By bruh · Published · Updated
Describe the question in English, get SQL that does not silently double your rows.
Tags: Data, Technical, Coding
Prompt template
Schema: [textarea: Tables, columns, types, primary and foreign keys] Question I want answered: [textarea: Plain English] Database: [dropdown: PostgreSQL, MySQL, BigQuery, Snowflake, SQL Server, SQLite] Rough table sizes: [text: Row counts, since it changes the approach] Give me the query, formatted, with comments on anything non-obvious. Then: what each join does and where one could fan out and duplicate rows, since that is the error that silently inflates every number downstream. How nulls are handled. Whether this needs an index at my row counts. Finish with a quick sanity check I can run to confirm the result is actually right.