T-SQL FizzBuzz Golf

Kevin Feasel

2017-05-23

T-SQL

Kenneth Fisher plays the FizzBuzz game with T-SQL and his chat piles on:

Now normally FizzBuzz is done with a loop, but as Russ said, we are using T-SQL so batch code is always the goal. That said, what table should I query to get the numbers 1-100? Well, I decided I’d just do something simple here and use a system view that’s more than 100 rows, the ROW_NUMBER function, and restrict it using TOP.

Read on to see several answers to this problem, some better than others.

Related Posts

Calculating Relative Risk In T-SQL

Mala Mahadevan explains how to calculate relative risk using T-SQL: In this post we will explore a common statistical term – Relative Risk, otherwise called Risk Factor. Relative Risk is a term that is important to understand when you are doing comparative studies of two groups that are different in some specific way. The most […]

Read More

Cochran-Mantel-Haenszel Test

Mala Mahadevan explains the Cochran-Mantel-Haenszel test, with two parts up so far.  First, her data set: Below is the script to create the table and dataset I used. This is just test data and not copied from anywhere. Second, an introduction to the test itself and solutions in R and T-SQL: This test is an […]

Read More

Categories