🏠 Início
Avaliações
📊 Todos os Benchmarks 🦖 Dinossauro v1 🦖 Dinossauro v2 ✅ Aplicações To-Do List 🎨 Páginas Livres Criativas 🎯 FSACB - Showcase Definitivo 🌍 Benchmark de Tradução
Modelos
🏆 Top 10 Modelos 🆓 Modelos Gratuitos 📋 Todos os Modelos ⚙️ Kilo Code
Recursos
💬 Biblioteca de Prompts 📖 Glossário de IA 🔗 Links Úteis
Advanced

Complex SQL Window Functions

#sql #data-analysis #optimization

Solve a complex data retrieval problem using advanced window functions and CTEs.

Given a dataset of sales transactions including transaction_id, user_id, amount, and timestamp, write a PostgreSQL query to calculate the 3-day moving average of sales per user alongside the user's total sales amount up to but not including the current transaction date. Use Common Table Expressions (CTEs) for clarity and window functions for frame calculation. Provide an explanation of how the frame clause affects the calculation.