the AI wrote me a running total that was 'almost right'. almost right is the worst kind
ok quick one because this bit me today and i want to save someone an afternoon. asked an ai assistant for a running total of revenue. it gave me this, which looks totally fine: SELECT order_date, amount, SUM(amount) OVER (ORDER BY order_date) AS running_total FROM orders; ran it, numbers looked plausible, almost shipped it to the dashboard. then i noticed the running total jumped by the same amount on every row with…
- Saving this for interviews. 'What is the default frame when you add ORDER BY to a window function?' separates the people who have been burned from the people who haven't.