Asosiy matnga o'tish

13. Payme: oylik o'sish

O'rtacha

Payme oylik aylanmasi monthly_revenue jadvalida.

Har bir oy uchun oldingi oyga nisbatan o'zgarishni hisoblang:

month, revenue, prev_revenue, diff.

  • prev_revenue — oldingi oy aylanmasi (birinchi oy uchun NULL)
  • diff — revenue - prev_revenue (birinchi oy uchun NULL)

Natijani oy bo'yicha o'sish tartibida saralang.

Jadval: monthly_revenue

UstunTuri
monthDATE
revenueNUMERIC(14,2)

Namuna ma'lumotlar

sample
monthly_revenue
monthDATErevenueNUMERIC(14,2)
2025-01-01120000000
2025-02-01135000000
2025-03-01128000000
Kutilgan natija
diffmonthrevenueprev_revenue
NULL2025-01-01120000000NULL
150000002025-02-01135000000120000000
-70000002025-03-01128000000135000000
sample-full
monthly_revenue
monthDATErevenueNUMERIC(14,2)
2024-07-0198000000
2024-08-01104500000
2024-09-0199800000
2024-10-01117200000
2024-11-01125900000
2024-12-01168400000
2025-01-01120000000
2025-02-01135000000
2025-03-01128000000
2025-04-01141700000
2025-05-01153200000
2025-06-01149900000
Kutilgan natija
diffmonthrevenueprev_revenue
NULL2024-07-0198000000NULL
65000002024-08-0110450000098000000
-47000002024-09-0199800000104500000
174000002024-10-0111720000099800000
87000002024-11-01125900000117200000
425000002024-12-01168400000125900000
-484000002025-01-01120000000168400000
150000002025-02-01135000000120000000
-70000002025-03-01128000000135000000
137000002025-04-01141700000128000000
115000002025-05-01153200000141700000
-33000002025-06-01149900000153200000
sample-extra
monthly_revenue
monthDATErevenueNUMERIC(14,2)
2024-11-01170149351.71
2024-12-16125900000
2025-04-28107478100
2025-02-1897374500
Kutilgan natija
diffmonthrevenueprev_revenue
NULL2024-11-01170149351.71NULL
-44249351.712024-12-16125900000170149351.71
-285255002025-02-1897374500125900000
101036002025-04-2810747810097374500

O'xshash masalalar

Konsol

Natijani ko'rish uchun so'rovni ishga tushiring.