- How do I calculate month-over-month growth in SQL?
- Ask in plain English — 'month-over-month revenue growth as a percentage.' nlqdb compiles the window function (`LAG(value) OVER (ORDER BY month)` to reach last month, then `(current - previous) / previous`), runs it in Postgres, and returns the per-period rows plus the SQL it ran. You get the growth column without hand-writing LAG or the zero-baseline guard. The honest limit: you have to name the period order it compares along.
- What's the difference between LAG and a self-join for period-over-period change?
- Both reach the previous period's value, but `LAG(value) OVER (ORDER BY period)` is one pass over ordered rows — no join, no off-by-one on the period key. A self-join on `period = period - 1` breaks on gaps and calendar boundaries (December to January). nlqdb picks the window form and shows the compiled SQL so you can confirm the order it walked.
- Can I compute year-over-year or week-over-week change too?
- Yes — they're the same window family with a different order and offset: `LAG(value, 12) OVER (ORDER BY month)` reaches the same month last year, `LAG(value) OVER (ORDER BY week)` the prior week. Ask for 'year-over-year' or 'week-over-week' and nlqdb compiles the offset, then shows the SQL so you can confirm the period and the step. The honest limit: name the period and how far back to look.
- Can I run period-over-period growth on a Postgres database I already run?
- Yes — connect it with the signed-in BYO connect verb (`nlq db connect`, `SK-DBCONN-001`; see /solve/query-existing-postgres-in-natural-language) and ask for the growth report in place, no ETL into a separate store. The honest limits: BYO connect is signed-in only (not the public embed), and nlqdb returns the comparison with a read-only query — it doesn't persist a materialized growth column for you.