🏠 Strona Główna
Benchmarki
📊 Wszystkie benchmarki 🦖 Dinozaur v1 🦖 Dinozaur v2 ✅ Aplikacje To-Do List 🎨 Kreatywne wolne strony 🎯 FSACB - Ostateczny pokaz 🌍 Benchmark tłumaczeń
Modele
🏆 Top 10 modeli 🆓 Darmowe modele 📋 Wszystkie modele ⚙️ Kilo Code
Zasoby
💬 Biblioteka promptów 📖 Słownik AI 🔗 Przydatne linki
Advanced

Complex SQL Window Functions

#sql #database #data-analysis #coding

Solve a complex data analysis problem using advanced SQL window functions.

Given a hypothetical table 'user_sessions' containing columns: user_id, session_start (timestamp), session_end (timestamp), and page_views (int). Write a single SQL query to calculate the moving average of page_views over the previous 3 sessions for each user, ordered by time. Additionally, identify the session with the maximum duration for each user and rank the users by their total engagement time without using subqueries in the FROM clause. Explain the execution plan and performance implications of your query.