advanced windowing MySQL MariaDB SQL Server PostgreSQL SQLite
Compare a Metric Year-Over-Year Using LAG
Pull the prior year's value into the current row with `LAG`, then compute the percentage change — a common pattern for revenue, signups, and other business KPIs.