🏠 Hem
Benchmarkar
📊 Alla benchmarkar 🦖 Dinosaur v1 🦖 Dinosaur v2 ✅ To-Do List-applikationer 🎨 Kreativa fria sidor 🎯 FSACB - Ultimata uppvisningen 🌍 Översättningsbenchmark
Modeller
🏆 Topp 10 modeller 🆓 Gratis modeller 📋 Alla modeller ⚙️ Kilo Code
Resurser
💬 Promptbibliotek 📖 AI-ordlista 🔗 Användbara länkar
Hard

Advanced SQL Window Functions

#sql #database #data-analysis

Construct a complex query using window functions to analyze time-series data.

Write a PostgreSQL query that calculates the 3-day moving average of sales for each product, alongside the difference from the previous day's sales, partitioned by store location. Handle NULL values by carrying forward the last known value using the IGNORE NULLS option within the window frame.