PMC ANALYTICS INTERVIEW QUESTION - Retrieve start date and end date based on the sequential data
DROP TABLE IF EXISTS Schedule
CREATE TABLE Schedule
(
Task_ID INT,
[Start_Date] DATETIME,
[End_Date] DATETIME
)
INSERT INTO Schedule
VALUES
(1,'2023-10-01','2023-10-02'),
(2,'2023-10-02','2023-10-03'),
(3,'2023-10-03','2023-10-04'),
(4,'2023-10-13','2023-10-14'),
(5,'2023-10-14','2023-10-15'),
(6,'2023-10-28','2023-10-29'),
(7,'2023-10-30','2023-10-31')
SELECT * FROM Schedule
Expected output:
--Output
--2015-10-28 2015-10-29
--2015-10-30 2015-10-31
--2015-10-13 2015-10-15
--2015-10-01 2015-10-04
Comments
Post a Comment