-- Вывести тех работников, которые старше своего руководителя
with Employees
as
(
select 1 as EmployeeID,
1 as DepartmentID,
0 as IsDirector,
'2000-08-11' as DateOfBirth
union all
select 2,
1,
0,
'2000-07-14'
union all
select 3,
1,
1,
'2001-06-05'
union all
select 4,
1,
0,
'2001-09-03'
union all
select 5,
2,
0,
'1999-03-08'
union all
select 6,
2,
1,
'2000-04-01'
union all
select 7,
2,
0,
'2001-01-28'
)
select *
from Employees