clear markdown compare help best fiddles feedback a leap of faith?
clear markdown donate comments/suggestions/bugs a leap of faith? bible365 diddy dollings
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0. 2335904 fiddles created (27466 in the last week).

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'), (4,'E04','Fedorov Fedor Fedorovich'), (5,'E05','Mihailov Mihail Mihailovich') -- Отпуска сотрудников 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-12-29', '2020-01-14') ,(2, '2019-05-01', '2019-05-15') ,(4,'2020-01-09','2020-02-05') ,(5,'2020-06-12','2020-07-14')
10 rows affected
 hidden batch(es)

SELECT e1.Name, e2.Name FROM Vacation v1 JOIN Vacation v2 ON v1.DateBegin < v2.DateEnd AND v2.DateBegin < v1.DateEnd AND v1.ID_Employee < v2.ID_Employee JOIN Employee e1 ON v1.ID_Employee = e1.ID JOIN Employee e2 ON v2.ID_Employee = e2.ID
Name Name
Ivanov Ivan Ivanovich Fedorov Fedor Fedorovich
 hidden batch(es)