Created
August 4, 2022 04:47
-
-
Save thomasthaddeus/6eb1bd56d9393ec9de99d1366b094656 to your computer and use it in GitHub Desktop.
Queries to remember
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 purchase_id, DATE(purchase_date, '7 days') | |
FROM purchases; | |
SELECT STRFTIME('%H', purchase_date) | |
FROM purchases; | |
SELECT date, (CAST(high AS 'REAL') + | |
CAST(low as 'REAL')) / 2.0 AS 'average' | |
FROM weather | |
; | |
SELECT ROW_NUMBER() | |
OVER ( | |
ORDER BY gross | |
) AS 'row_num', title, week, gross | |
FROM box_office; | |
SELECT title, week, gross, | |
SUM(gross) OVER ( | |
PARTITION BY title | |
ORDER BY week | |
) AS 'running_total_gross' | |
FROM box_office; |
Author
thomasthaddeus
commented
Aug 4, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment