Created
July 10, 2025 13:07
-
-
Save dontpaniclabsgists/c484c25ede8dd2f87d4da49e5aa687d2 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 | |
h.n as HourOfDay, | |
CASE | |
WHEN h.n BETWEEN 9 AND 17 THEN 15 + (h.n % 5) -- Higher during business hours | |
WHEN h.n BETWEEN 18 AND 22 THEN 8 + (h.n % 3) -- Medium in evening | |
ELSE 2 + (h.n % 3) -- Lower at night/early morning | |
END as OrderCount | |
FROM ( | |
SELECT 0 as n UNION SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5 | |
UNION SELECT 6 UNION SELECT 7 UNION SELECT 8 UNION SELECT 9 UNION SELECT 10 UNION SELECT 11 | |
UNION SELECT 12 UNION SELECT 13 UNION SELECT 14 UNION SELECT 15 UNION SELECT 16 UNION SELECT 17 | |
UNION SELECT 18 UNION SELECT 19 UNION SELECT 20 UNION SELECT 21 UNION SELECT 22 UNION SELECT 23 | |
) h | |
ORDER BY h.n |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment