Get the App
SLTechnology News&Howtos  ›  Database  › 

Mysql from is followed by a subquery, which actually aggregates the results into a table

Shulou Source: shulou.com Published: 2022-06-01 22:40:26 11月07日 Update

# case: query the salary scale of the average salary of each department

SELECT av.*, g.`grade _ level`from (SELECT AVG (salary) ag,department_id FROM employees GROUP BY department_id) avINNER JOIN job_grades gON av.ag BETWEEN g.`lowest _ sal`AND g.`highest _ sal`

Tags: Salary inquiry case grade department actual result and Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno vpn MySQL Linux Shulou Technology Huawei