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


- DROP TABLE IF EXISTS [Event];


CREATE TABLE [Event] (

    session_id INT,

    event_type VARCHAR(50),

    event_time DATETIME

);



-- Dataset 3: Customers frequently search for items before viewing or adding to cart
INSERT INTO Events (session_id, event_type, event_time)
VALUES
(1, 'login', '2024-10-03 08:00:00'),
(1, 'search', '2024-10-03 08:05:00'),
(1, 'view', '2024-10-03 08:10:00'),
(1, 'add_to_cart', '2024-10-03 08:15:00'),
(1, 'purchase', '2024-10-03 08:20:00'),
(2, 'login', '2024-10-03 09:00:00'),
(2, 'search', '2024-10-03 09:05:00'),
(2, 'view', '2024-10-03 09:10:00'),
(2, 'purchase', '2024-10-03 09:15:00'),
(3, 'login', '2024-10-03 10:00:00'),
(3, 'search', '2024-10-03 10:05:00'),
(3, 'view', '2024-10-03 10:10:00'),
(3, 'add_to_cart', '2024-10-03 10:15:00'),
(3, 'purchase', '2024-10-03 10:20: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