FastPrepEmployees Above Average Salary

Employees Above Average Salary

JP Morgan Chase logoJP Morgan Chase● EasyFULLTIMEONSITE INTERVIEW

Problem statement

The table employees stores one row per employee and their salary.

Compute the average salary across all rows. Return every employee whose salary is strictly greater than that overall average.

Return employee_id, employee_name, and salary. Order rows by salary descending, then employee_id ascending.

What the interview report shared

The interview report listed a SQL task about employees whose salary is greater than the average salary.

employees
ColumnMeaning
employee_idUnique employee identifier
employee_nameEmployee display name
salaryEmployee 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.

employees

One row per employee.

ColumnTypeNullableDescription
employee_idPKIntegerNo—
employee_nameTextNo—
salaryIntegerNo—

Expected result

Your query or function must return these columns.

ColumnTypeNullableDescription
employee_idIntegerNo—
employee_nameTextNo—
salaryIntegerNo—

Row order: must match exactly. Numeric tolerance: 0.

Constraints

  • The employees table has between 1 and 10^5 rows.
  • employee_id is unique and non-null.
  • employee_name and salary are non-null.
  • 0 <= salary <= 10^9.

More JP Morgan Chase problems

See JP Morgan Chase hiring insights