Mu Sigma SQL INTERVIEW QUESTION | Consecutive events count - Dataset 2


- DROP TABLE IF EXISTS [Event];


CREATE TABLE [Event] (

    session_id INT,

    event_type VARCHAR(50),

    event_time DATETIME

);



-- Dataset 2 

INSERT INTO Events (session_id, event_type, event_time)

VALUES

(1, 'login', '2024-10-05 08:00:00'),

(1, 'view', '2024-10-05 08:05:00'),

(1, 'view', '2024-10-05 08:10:00'),

(1, 'add_to_cart', '2024-10-05 08:15:00'),

(2, 'login', '2024-10-05 09:00:00'),

(2, 'view', '2024-10-05 09:05:00'),

(2, 'view', '2024-10-05 09:10:00'),

(2, 'add_to_cart', '2024-10-05 09:15:00'),

(2, 'purchase', '2024-10-05 09:20:00'),

(3, 'login', '2024-10-05 10:00:00'),

(3, 'view', '2024-10-05 10:05:00'),

(3, 'view', '2024-10-05 10:10:00'),

(3, 'add_to_cart', '2024-10-05 10:15:00');

 

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