It can be obtained in a single select???
An example company ID, department and production carried out
Obtain the percentage of production: the production of the person between the production of his department of his department ( production person * 100 / production department
Department production:
select departamento, sum(produción) from empresa group by departamento
worker production
select dni, departamento,sum(produción) from empresa group by dni,departamento