🏠 Accueil
Benchmarks
📊 Tous les Benchmarks 🦖 Dinosaure v1 🦖 Dinosaure v2 ✅ To-Do List Apps 🎨 Pages Libres 🎯 FSACB - Showcase 🌍 Traduction
Modèles
🏆 Top 10 Modèles 🆓 Modèles Gratuits 📋 Tous les Modèles ⚙️ Modes Kilo Code
Ressources
💬 Prompts IA 📖 Glossaire IA 🔗 Liens Utiles
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.