Skip to content

Instantly share code, notes, and snippets.

@hidayat365
hidayat365 / FizzBuzz.sql
Created March 15, 2012 06:21
Fizz Buzz Solution using MySQL
select
-- logic untuk fizzbuzz
case
when baris %15 = 0 then 'FizzBuzz'
when baris %3 = 0 then 'Fizz'
when baris %5 = 0 then 'Buzz'
else baris end fizzbuzz
from (
-- generate 100 baris row dan beri nomor
select @no := @no+1 baris