2. Big Companies
An organization maintains employment data in three tables: EMPLOVEE, COMPANY, and SALARY. Write a query to print the names of every company where the average salary is greater than or equal to 40000 . Each distinct row of results in the output must contain the name of a company whose average employee salary is 240,000 in the COMPANY.NAME format.
 Schema
 Sample Data Tables

Respuesta :

The queries can be written on the behalf of company names by selecting them from options with respect to their salaries.

Which query is used to find the average salary of the employee?

The query that is used to find the average salary of the employee is as follows:

  • SELECT AVG(salary) AS "Avg Salary" FROM employees WHERE salary > 25000.

In this AVG function example, we've aliased the AVG(salary) expression as "Avg Salary". As a result, "Avg Salary" will display as the field name when the result set is returned.

The same principle is applied in the query that is used to print the names of every company where the average salary is greater than or equal to 40000, i.e. SELECT c.name FROM company c JOIN salary s ON c.id = s.company_id GROUP BY c.name HAVING AVG(salary) >= 40000.

Therefore, the queries can be written on the behalf of company names by selecting them from options with respect to their salaries.

To learn more about Employment salary, refer to the link:

https://brainly.com/question/24988098

#SPJ1