Created
December 9, 2021 08:52
-
-
Save Mr--John-Doe/6c9009b379adb02251ca3141520af600 to your computer and use it in GitHub Desktop.
windows function - basics - example#2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WITH agg AS ( | |
SELECT depname, AVG(salary) avg_salary | |
FROM empsalary | |
GROUP BY depname | |
) | |
SELECT depname, empno, salary, avg_salary | |
FROM empsalary | |
INNER JOIN agg | |
USING (depname) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment