SQL Reporting Query Set for Monthly Business Metrics
Write a reusable set of queries for standard metrics.
The Open buttons send the prompt text as currently shown below to that site only when you click. Fill in the placeholders first.
[VERIFY] is an editorial flag, not a blank to fill. Wherever the prompt shows [VERIFY], check that item against a reliable source before you use it.
Write monthly reporting queries. Tables, columns and relationships: [SCHEMA]. Metrics wanted: [METRICS], for example revenue, orders, average order value, new and returning customers, refunds. Definitions I use: [DEFINITIONS]. Database system: [DATABASE]. Do not guess definitions; list the questions I should answer first and the assumptions I must confirm. For each metric write a query returning one row per month, with the month calculated in a way that works in my database [VERIFY], and explain the definition in a comment. Handle edge cases: months with no data, refunds in a later month, time zones and cancelled orders. Add a final combined query joining the metrics side by side, performance notes for large tables, and a check against a known total. Worked check: if March has 3 orders of 100, 50 and 25, revenue is 175 and average order value is 58.33. Keep each query short enough to review in a minute, and put the definitions in comments at the top. If a definition is missing, write the question instead of choosing one.
Fill in before use
Optional: type your details and the prompt above updates. Nothing is saved or sent.
Replace each bracketed placeholder with your own details, then paste into Any AI or another assistant.