SQL Taskbook Level 7.3

The tables are given:

heads_of_departments
id name age
1 John 32
2 Mattew 40
3 Bill 25
4 Alex 28
5 Max 34
employees
id name age head_of_department_id
1 Andrew 19 2
1 Andrew 19 2
2 Julia 25 3
3 Karl 26 5
4 Donella 28 5
5 Barret 29 1
6 Alex 32 4
7 Donald 33 3
8 Brad 20 4
9 Omie 21 3
10 Mark 22 1

Solve the following tasks for them:

Задание 1

Select all ages of superiors and subordinates.

Задание 2

Select all ages of superiors and subordinates only unique values.

Задание 3

Select bosses whose age is similar to the age of any subordinate.

Задание 4

Select the bosses whose age is greater than that of all their subordinates.

Задание 5

Select subordinates whose age is similar to the age of any boss.

Задание 6

Select subordinates whose age is less than that of all superiors.