セクション 1. 章 12
single
Challenge: Employees With More Than Average Salary
メニューを表示するにはスワイプしてください
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)
タスク
スワイプしてコーディングを開始
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, andsalarycolumns from theemployeestable. - In the
WHEREclause, use an inner query with the syntaxsalary > [inner query]. - In the inner query, get the average value of the
salarycolumn from theemployeestable. - Sort the results by
salaryin descending order.
解答
すべて明確でしたか?
フィードバックありがとうございます!
セクション 1. 章 12
single
AIに質問する
AIに質問する
何でも質問するか、提案された質問の1つを試してチャットを始めてください