FastPrepCompanies with Average Salary Above 40000

Companies with Average Salary Above 40000

AT&T logoAT&T● EasyFULLTIMEOA

Problem statement

The tables EMPLOYEE, COMPANY, and SALARY describe employees, companies, and salary observations. Return the NAME of each company whose average SALARY is strictly greater than 40000.

Calculate the average separately for each company ID, using every salary row for that company. Company names need not be unique, so distinct qualifying companies may produce the same name more than once. Exclude companies with no salary rows. Return a single column named NAME; rows may appear in any order. The EMPLOYEE table is provided, but the COMPANY and SALARY tables contain everything needed for this query.

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.

EMPLOYEE

ColumnTypeNullableDescription
IDPKIntegerNo—
NAMETextNo—

COMPANY

ColumnTypeNullableDescription
IDPKIntegerNo—
NAMETextNo—

SALARY

ColumnTypeNullableDescription
EMPLOYEE_IDIntegerNo—
COMPANY_IDIntegerNo—
SALARYIntegerNo—

Foreign key: EMPLOYEE_ID → EMPLOYEE(ID)

Foreign key: COMPANY_ID → COMPANY(ID)

Expected result

Your query or function must return these columns.

ColumnTypeNullableDescription
NAMETextNo—

Row order: any order is accepted. Numeric tolerance: 0.

Constraints

  • EMPLOYEE.ID and COMPANY.ID are unique integers in the inclusive range[1,1000].
  • Every employee and company name has between 1 and 100 characters. Names need not be unique.
  • SALARY.EMPLOYEE_ID and SALARY.COMPANY_ID reference existing IDs in the corresponding tables.
  • Each SALARY value is an integer in the inclusive range[20000,100000].
  • There are 0 to 1000 employee rows,0 to 1000 company rows, and0 to 10000 salary rows. Salary rows may repeat.
  • Compute the ordinary row-weighted average without rounding or truncating it. Return all qualifying company names, preserving duplicates from distinct company IDs, in any order.

More AT&T problems

See AT&T hiring insights