Last active
August 29, 2015 14:14
-
-
Save st98/612f692861e19e1bfe23 to your computer and use it in GitHub Desktop.
SQL で FizzBuzz。
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 recursive t(x, s) as ( | |
select 0, NULL union all select x + 1, | |
case | |
when (x + 1) % 15 = 0 then 'FizzBuzz' | |
when (x + 1) % 3 = 0 then 'Fizz' | |
when (x + 1) % 5 = 0 then 'Buzz' | |
else (x + 1) | |
end | |
from t limit 1, 100 | |
) select s from t; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment