Monthly Active Users (MAU) using SQL | Meta | SQL Joins interview question

 DML Script:

DROP TABLE IF EXISTS user_actions;


CREATE TABLE user_actions

(

[user_id] int,

[event_id] int,

[event_type] varchar(100),

[event_date] datetime

)


INSERT INTO user_actions

VALUES

(445,7765,'like','05/31/2022'),

(742,7766,'sign-in','06/03/2022'),

(445,7767,'comment','06/05/2022'),

(742,7768,'comment','06/05/2022'),

(648,7769,'like','06/18/2022'),

(742,7770,'sign-in','05/22/2022'),

(648,7771,'sign-in','05/18/2022'),

(648,7772,'like','05/19/2022') ,

(445,7872,'sign-in','05/19/2022') ,

(445,7972,'sign-in','06/08/2022') , 

(745,7770,'sign-in','06/22/2022'),

(648,8771,'sign-in','07/18/2022'),

(648,8772,'like','07/18/2022') ,

(745,8872,'sign-in','07/19/2022') ,

(745,8972,'comment','07/08/2022')  


 SELECT * FROM user_actions


Detailed explanation: https://youtu.be/hwiCmu6zus0

Comments

Popular posts from this blog

50 Essential SQL Questions to Land Your Dream Job

How to find all the customers who placed orders on three consecutive days | SQL Scenario questions

ACCENTURE SQL INTERVIEW QUESTION | Change the ProductIDs