Skip to content

Instantly share code, notes, and snippets.

@josephrexme
Created August 22, 2016 00:53
Show Gist options
  • Save josephrexme/832bc820e428aef431e09e90f214a687 to your computer and use it in GitHub Desktop.
Save josephrexme/832bc820e428aef431e09e90f214a687 to your computer and use it in GitHub Desktop.
Fizzbuzz in postgresql
select generate_series as num,
case when generate_series % 15 = 0
then 'fizzbuzz'
when generate_series % 3 = 0
then 'fizz'
when generate_series % 5 = 0
then 'buzz'
else '' end
as fizzbuzz
from generate_series(1, 100);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment