Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Impara Challenge: Employees With More Than Average Salary | Sottoquery Annidate
SQL Intermedio
Sezione 2. Capitolo 4
single

single

Challenge: Employees With More Than Average Salary

Scorri per mostrare il menu

When a subquery is written in the WHERE section, we can use the IN operator and comparison operators:

SELECT column1, ...
FROM table
WHERE column1 > (SELECT AGG(column2) FROM table)
Compito

Scorri per iniziare a programmare

Find employees whose salary is above the average salary of all employees using a subquery in the WHERE section.

The resulting table should have 3 columns: first_name, last_name, and salary. Then, sort the result by salary from highest to lowest using ORDER BY.

This syntax can be used as a great alternative to the HAVING clause.

Brief Instructions

  • Retrieve the first_name, last_name, and salary columns from the employees table.
  • In the WHERE clause, use an inner query with the syntax salary > [inner query].
  • In the inner query, get the average value of the salary column from the employees table.
  • Sort the results by salary in descending order.

Soluzione

Switch to desktopCambia al desktop per esercitarti nel mondo realeContinua da dove ti trovi utilizzando una delle opzioni seguenti
Tutto è chiaro?

Come possiamo migliorarlo?

Grazie per i tuoi commenti!

Sezione 2. Capitolo 4
single

single

Chieda ad AI

expand

Chieda ad AI

ChatGPT

Chieda pure quello che desidera o provi una delle domande suggerite per iniziare la nostra conversazione

some-alt