Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lære Challenge: Find High Earners by Department | Nested Subqueries in the WHERE section
Practice
Projects
Quizzes & Challenges
Quizer
Challenges
/
Generate Nested Subqueries in SQL
Seksjon 1. Kapittel 4
single

single

bookChallenge: Find High Earners by Department

Sveip for å vise menyen

Oppgave

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, and department_id columns from the employees table.
  • 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.

Løsning

Switch to desktopBytt til skrivebordet for virkelighetspraksisFortsett der du er med et av alternativene nedenfor
Alt var klart?

Hvordan kan vi forbedre det?

Takk for tilbakemeldingene dine!

Seksjon 1. Kapittel 4
single

single

Spør AI

expand

Spør AI

ChatGPT

Spør om hva du vil, eller prøv ett av de foreslåtte spørsmålene for å starte chatten vår

some-alt