🏠 Главная
Бенчмарки
📊 Все бенчмарки 🦖 Динозавр v1 🦖 Динозавр v2 ✅ Приложения To-Do List 🎨 Творческие свободные страницы 🎯 FSACB - Ультимативный показ 🌍 Бенчмарк перевода
Модели
🏆 Топ-10 моделей 🆓 Бесплатные модели 📋 Все модели ⚙️ Режимы Kilo Code
Ресурсы
💬 Библиотека промптов 📖 Глоссарий ИИ 🔗 Полезные ссылки
advanced

Complex Time-Series Analysis with SQL

#sql #data-analysis #window-functions

Solve a retention analysis problem using advanced window functions.

Write a SQL query to calculate the cohort retention rate for a subscription service. The input is a table of user logs (user_id, log_date, action). Your query must calculate the percentage of users who return in the 1st, 2nd, and 3rd months after their initial signup. Use window functions such as LAG, LEAD, and FIRST_VALUE to achieve this without using self-joins. Handle the scenario where a user churns and returns, ensuring they are counted based on their latest cohort.