Osio 1. Luku 4
single
Challenge: Find High Earners by Department
Pyyhkäise näyttääksesi valikon
Tehtävä
Swipe to start coding
Write a SQL query to list all employees whose salary is higher than the average salary of their department. Use a correlated subquery in the WHERE clause to compare each employee's salary to the average salary for their department.
- Select the
employee_id,first_name,last_name,salary, anddepartment_idcolumns from theemployeestable. - For each employee, use a correlated subquery in the WHERE clause to calculate the average salary for their department.
- Include only those employees whose salary is greater than the average salary of their department.
Ratkaisu
Oliko kaikki selvää?
Kiitos palautteestasi!
Osio 1. Luku 4
single
Kysy tekoälyä
Kysy tekoälyä
Kysy mitä tahansa tai kokeile jotakin ehdotetuista kysymyksistä aloittaaksesi keskustelumme