-- Справочник сотрудников
create table Employee (
ID int not null primary key,
Code varchar(10) not null unique,
Name varchar(255)
);
insert into Employee (ID, Code, Name)
values (1, 'E01', 'Ivanov Ivan Ivanovich'),
(2, 'E02', 'Petrov Petr Petrovich'),
(3, 'E03', 'Sidorov Sidr Sidorovich')
;
-- Отпуска сотрудников
create table Vacation (
ID int not null identity(1, 1) primary key,
ID_Employee int not null references Employee(ID),
DateBegin date not null,
DateEnd date not null
);
insert into Vacation (ID_Employee, DateBegin, DateEnd)
values (1, '2019-08-10', '2019-09-01')
,(1, '2019-05-13', '2019-06-02')
,(1, '2019-12-29', '2020-01-14')
,(2, '2019-05-01', '2019-05-15');
select name from Employee
where id not in
(
select id from Vacation
where year(DateBegin) = 2020 or year(DateEnd) = 2020
)