FizzBuzz

,

Can you solve this in T-SQL?

"Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”."

Sounds easy enough, and while some set based solution would take a little time, do you think you could solve this easily inside of 5 minutes during an interview? I think I could, since the algorithm that I'd use is fairly simple, though I'd be using a simple loop.

This short test has become known as the FizzBuzz test, and along with similar questions, it being used by some companies to weed out applicants that can't program. I'm surprised that anyone applying for a programming job couldn't solve this easily, and within 10 minutes at the outside. Ten minutes is a long time, and you'd be losing points on my internal scorecard fairly quickly after 3 or 4 minutes.

I don't know if that's a good test for T-SQL, but I've had similar FizzBuzz type questions in the past for people. Two of my favorites have been returning the identity value from an insert and writing a short query to find duplicates. Solving those doesn't necessarily mean that you can write code, but if you can't solve them, chances are you aren't very good at writing T-SQL.

I still think that finding a good team fit is more important than finding the best talent overall, but I do think that assessing some minimum level of ability is important. You can always teach people to code better, but if they can't understand code at all, you might not be able to teach them enough to do the job.

Steve Jones


The Voice of the DBA Podcasts

Everyday Jones

The podcast feeds are available at sqlservercentral.mevio.com. Comments are definitely appreciated and wanted, and you can get feeds from there.

You can also follow Steve Jones on Twitter:

Overall RSS Feed:

or now on iTunes!

Today's podcast features music by Everyday Jones. No relation, but I stumbled on to them and really like the music. Support this great duo at www.everydayjones.com.

Rate

5 (1)

Share

Share

Rate

5 (1)