Created
November 4, 2016 19:48
-
-
Save andrewscaya/89eaddccf7ccc7218e73a2daf912137c to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| SELECT | |
| event_id, | |
| date - lag(date) OVER (PARTITION BY event_id ORDER BY date) as difference | |
| FROM | |
| events; |
This file contains hidden or 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
| SELECT | |
| dept, | |
| name, | |
| salary, | |
| AVG(salary) as avg_salary OVER (PARTITION BY dept) | |
| FROM | |
| employees; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment