🏠 Beranda
Benchmark
📊 Semua Benchmark 🦖 Dinosaurus v1 🦖 Dinosaurus v2 ✅ Aplikasi To-Do List 🎨 Halaman Bebas Kreatif 🎯 FSACB - Showcase Utama 🌍 Benchmark Terjemahan
Model
🏆 Top 10 Model 🆓 Model Gratis 📋 Semua Model ⚙️ Kilo Code
Sumber Daya
💬 Perpustakaan Prompt 📖 Glosarium AI 🔗 Tautan Berguna
advanced

Complex Time-Series Analysis with SQL Window Functions

#sql #database #data-analysis

Solve a data retrieval problem requiring intricate calculation over sliding windows and frame clauses.

Given a table 'stock_prices' with columns 'symbol', 'trade_date', and 'close_price', write a single SQL query that calculates the 30-day moving average, the exponential moving average with a smoothing factor of 0.2, and the Bollinger Bands (upper and lower) for each symbol. The query should return only dates where the closing price crosses above the upper Bollinger Band. Assume a standard PostgreSQL environment. Explain the choice of window frame clauses (RANGE vs. ROWS) and their impact on handling missing dates in the data.