Companies Above a Salary Threshold
Problem statement
The companies table stores canonical company names, and salaries stores employee salaries linked by company identifier.
Return the name of every company whose average salary is strictly greater than 40000. Order rows by company_id ascending.
| Table | Columns |
|---|---|
companies | company_id, company_name |
salaries | employee_id, company_id, salary |
Table schema
MySQLPostgreSQLPandas
Use the same input data with any supported language. Open the Schema tab in the editor to see the generated SQL setup or Pandas DataFrames.
companies
One row per company.
| Column | Type | Nullable | Description |
|---|---|---|---|
| company_idPK | Integer | No | — |
| company_name | Text | No | — |
salaries
One salary row per employee.
| Column | Type | Nullable | Description |
|---|---|---|---|
| employee_idPK | Integer | No | — |
| company_id | Integer | No | — |
| salary | Integer | No | — |
Expected result
Your query or function must return these columns.
| Column | Type | Nullable | Description |
|---|---|---|---|
| company_name | Text | No | — |
Row order: must match exactly. Numeric tolerance: 0.
Constraints
- Each table contains between 1 and 100000 rows.
- Identifiers and names are non-null; every salary row references a company.
0 <= salary <= 1000000000.