SQL query: select inside select


Hi everyone! I am from Brazil and I would like to ask you for some help, if possible. Please, I need a solution about an SQL select statement. I have a database on mysql administrator. I am attaching an illustration with the entity relationship diagram of my database. I need to make a SQL Select query for it to produce the following result:

  1. One table which returns the names of the projects of the employee who earns the smallest salary and the employee who earns the biggest salary.
  2. One table which returns the total number of dependents of the employee who earns the smallest salary and the employee who earns the biggest salary.
    I’m sorry if you don’t understand my post, but English is not my first language and here in Brazil we don’t have enough English lessons. Thank you very much for any answers!
    the link of database ilustration: https://etecspgov-my.sharepoint.com/:i:/g/personal/alessandra_souza61_etec_sp_gov_br/EQQTKf_ECAtFgI_qHpzjTZEB63hh913gfB-8MP8LqIUDQw?e=DzCR0H

You need to determine the max(salary) and then the employee who has it
Then the min(salary) and the employee who has that
Bear in mind that several people may have the same salary, so you may choose to select one of them, or all of them.

take these together as a UNION query so now you have a view that returns at least one row (remember there may only be one employee)

And then lookup dependants for the employee IDs

Since this looks like homework, Im not going to do the whole solution for you here.

While I am here, the employee table is not properly normalised.
An employee is almost certainly going to be associated with more than one project, even if not at the same time.
You need an employee table, and one which links employees to projects and departments on a 1 to n basis

Weird. Seems some kind of test or whatever. Not real life.