with maxbottles( num ) as ( values 99 ), strings( bottle, ofbeer, onthewall, comma, period, newline ) as ( values (' bottle', ' of beer', ' on the wall', ', ', '.', X'0A0D') ), count( num ) as ( select num from maxbottles union all select num - 1 from count where num > 0 ), zero( num, bign, smalln, omore, store ) as ( values (0, 'N', 'n', 'o more', 'Go to the store and buy some more') ), one( num, singular ) as ( values (1, '') ), bottles( num, bign, smalln, omore, store, singular ) as (