在 Microsoft SQL 服务器中以正确安排或连续的方式处理此分配以获取日期的正确方法是什么

What would be the proper method to approach this assignment to get the Date in the proper arranged or consecutive manner in Microsoft SQL server

我完全没有头绪,但已经尝试了 group by 的一些事情,并且都对任何答案持开放态度

抱歉,新来的,请帮忙谢谢!`

CREATE DATABASE project ;
CREATE TABLE project_phases(
project_id int,
phase varchar(200),
start_date date
);

INSERT INTO project_phases (project_id,phase,start_date)
VALUES (1, 'design', '2021-01-01');

INSERT INTO project_phases (project_id,phase,start_date)
VALUES (1, 'development', '2021-01-02');

INSERT INTO project_phases (project_id,phase,start_date)
VALUES (1, 'deployment', '2021-01-03');`

似乎 window 函数 lead() over() 很适合这里

Select project_id
      ,from_phase   = phase
      ,to_phase     = lead(phase,1) over (partition by project_id order by start_date)
      ,start_date
      ,end_date     = lead(start_date,1) over (partition by project_id order by start_date)
from project_phases

结果