SQL query generator from a plain-English request
Converts a natural-language data requirement plus a table schema into a syntactically correct SQL query for a named database, with its assumptions stated up front.
Check join cardinality and aggregation grain to explain duplicate rows or double-counted measures before changing a reporting query.
No public result for version 1 yet
Version 1 · 2 variables · 2 required
Fill in the values below — the customized prompt updates as you type. marks a required value.
The actual reporting SQL. Default: SELECT o.id, SUM(i.amount) AS item_total, SUM(p.amount) AS paid FROM orders o JOIN items i ON i.order_id=o.id JOIN payments p ON p.order_id=o.id GROUP BY o.id;
Declared keys, relationship cardinality and intended measure grain. Default: orders: one row per order, id primary key. items: many rows per order. payments: possibly several payments per order. Goal: item value and paid amount per order, including unpaid orders.
Audit the correctness of these joins.
Query: SELECT o.id, SUM(i.amount) AS item_total, SUM(p.amount) AS paid FROM orders o JOIN items i ON i.order_id=o.id JOIN payments p ON p.order_id=o.id GROUP BY o.id;
Table grain, keys and business meaning: orders: one row per order, id primary key. items: many rows per order. payments: possibly several payments per order. Goal: item value and paid amount per order, including unpaid orders.
Trace the expected row grain after every join. Identify one-to-many or many-to-many relationships that can multiply measures, missing join predicates, null-key behavior and filters that change outer joins.
Use a small hand-worked example to show any supported multiplication risk; label it illustrative. Explain whether the intended measure belongs to an order, line, payment or other grain. Do not use DISTINCT as a blanket repair.
Propose the smallest correction, such as aggregating each detail relation before joining, and state the semantics it preserves. List checks for key uniqueness, unmatched rows and reconciliation to independent totals. Do not claim the corrected query ran or that inferred keys are real constraints.No public examples yet for version 1
Converts a natural-language data requirement plus a table schema into a syntactically correct SQL query for a named database, with its assumptions stated up front.
No public results yet
Specify temporal evaluation, leakage checks, baselines and business-relevant metrics before judging a forecasting model.
No public results yet
Review a chart's scales, labels, aggregation and claims, separating visual issues from data questions that need verification.
No public results yet
Label supplied comments consistently while preserving mixed opinions, unclear cases and the exact words supporting each label.
No public results yet
Produce a deterministic transformation from repeated measure columns to tidy rows with explicit keys, types and missing-value rules.
No public results yet
Specify cohort membership, return behavior and observation maturity so retention percentages remain comparable.
Oldest first · one level of replies
Sign in to join the discussion. Share what you learned or made with this prompt.
No comments yet
Be the first to share how this prompt worked for you.