当前位置:网站首页>True MySQL interview question (19) -- Tiktok -- select the list of users who have logged in for two consecutive days every month
True MySQL interview question (19) -- Tiktok -- select the list of users who have logged in for two consecutive days every month
2022-06-22 07:12:00 【Socialphobia_ FOGO】
Check that there is continuous login every month 2 User list of days
There is a “ User login record form ”, Contains two fields : user id、 date .
give the result as follows :
# Inquire about 2021 Every month of the year , continuity 2 There is a list of logged in users every day .
SELECT DISTINCT
MONTH( date ) AS month ,
user id
FROM
(SELECT
*,
lead ( date ) over (
PARTITION BY user id,
MONTH( date )
ORDER BY date
) AS Next login date of this month
FROM
User login record form
WHERE YEAR( date ) = 2021) a
WHERE DATEDIFF(
Next login date of this month ,
date
) = 1
ORDER BY month
边栏推荐
- Introduction to 51 Single Chip Microcomputer -- timer and external interrupt
- Sharing the strongest summer vacation plan of ape tutoring: the summer vacation plan is the same as learning and playing
- Custom implementation of bind method in JS
- ROS QT environment construction
- 【GAN】W-GAN ICLR‘17, ICML‘17
- [outside distribution detection] your classifier is secret an energy based model and you head treat it like one ICLR '20
- Successfully solved raise keyerror (F "none of [{key}] are in the [{axis\u name}]") keyerror: "none of [index (['age.in.y
- Use of sessionstorage and localstorage
- Realization of median filter with MATLAB
- 网站预缓存代码
猜你喜欢
![[meta learning] classic work MAML and reply (Demo understands meta learning mechanism)](/img/e5/ea68e197834ddcfe10a14e631c68d6.jpg)
[meta learning] classic work MAML and reply (Demo understands meta learning mechanism)

自然语言处理理论和应用

Xh_CMS渗透测试文档

Antd framework: click the link to reopen the browser page - Basic accumulation

Error when connecting MySQL with dbeaver for the first time

Cesium loading 3D tiles model

OpenGL - Textures

From violent recursion to dynamic programming

Introduction to 51 single chip microcomputer - LED light
The solution of word document being locked and unable to edit
随机推荐
Quelles industries les diplômés recherchent - ils en 2022?
Set the way that liquid (Jekyll) is displayed in markdown but not parsed
The journey of an operator in the framework of deep learning
Rviz ROS wiki official website tutorial learning notes (1) - User Guide
Theory and application of naturallanguageprocessing
Golang calls sdl2, plays PCM audio, and reports an error signal arrived during external code execution.
Canoe uses tricks to export data from logging file/trace to Matlab for analysis
一个算子在深度学习框架中的旅程
Pdf to picture implementation
MySQL面试真题(二十)——视频数据分析实战
【实习】跨域问题
[meta learning] classic work MAML and reply (Demo understands meta learning mechanism)
golang調用sdl2,播放pcm音頻,報錯signal arrived during external code execution。
The mountains and rivers are heavy, and there is no doubt that there is no way out. There is another village where the willows are dark and the flowers are bright.
cookie的介绍和使用
圣杯布局和双飞翼布局的区别
Self attention (notes, for personal use)
Introduction to 51 Single Chip Microcomputer -- digital tube
[out of distribution detection] deep analog detection with outlier exposure ICLR '19
[out of distribution detection] energy based out of distribution detection nips' 20