Warm-up · Activity 1 of 7
Warm-up: a table has 10 employees in 3 departments. How many rows does this return?
SELECT depname, avg(salary)
FROM empsalary
GROUP BY depname;// Lesson 1 of 1 · ~25 min · Intermediate
After this lesson you can add a per-group average or a ranking to every row of a result, and you will know why you cannot filter on it in WHERE.
You will be able to
Warm-up · Activity 1 of 7
SELECT depname, avg(salary)
FROM empsalary
GROUP BY depname;Predict · Activity 2 of 7
SELECT depname, empno, salary,
avg(salary) OVER (PARTITION BY depname)
FROM empsalary;Practice · Activity 3 of 7
SELECT depname, empno, salary,
rank() OVER (____ depname ORDER BY salary DESC)
FROM empsalary;Practice · Activity 4 of 7
Practice · Activity 5 of 7
SELECT depname, empno, salary
FROM empsalary
WHERE rank() OVER (PARTITION BY depname ORDER BY salary DESC) = 1;Brain teaser · Activity 6 of 7
Apply · Activity 7 of 7
Check your work against this list
5 questions, no hints. Score 80% or more to complete the lesson.
Finish every activity above to unlock the exit ticket.