At night, the ice weasels come.
Loosely Typed in Ohio

FizzBuzz…For developers that need to know SQL.

The tech blogosphere was humming last week about FizzBuzz, a simple test to figure out if your candidate can write even a trivial program.

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”.

At Innova, we've always been into test-first hiring, but we've recently started asking candidates to write some code over the phone to avoid the disruption that on-site shadowing experiences can create for both candidates and Innova.

Like most shops, we spend a lot of time doing basic CRUD. Unlike most shops, we're using databases for lots of heavy data processing too. Our biggest databases have surpassed 1TB now. While we have a great DBA for handling the plumbing, we still need developers who know how to work with data. The thing about FizzBuzz, is that it is almost too easy. Yet there are an outrageous number of programmers who can't solve it properly.

I came up with another similar question last week, and with a few phone screens under our belt (three four to be exact), we've been shocked that none of our candidates could answer it, even with lots of hints. And we're trying to hire experienced developers (>>8 years).

Now, this question is harder than FizzBuzz to be sure, and because it is deceptively simple (versus being truly fall-off-a-log simple), it tends to make people who don't like to think very hard stick out like a sore thumb. Already, we've elliminated a few people who probably program mostly by coincidence. Here is the question:

I've been looking for a new TV set. To get the best price, I've been tracking TV sets at Best Buy for the past month to see how the prices fluctuate. To do this, I've been updating a table: T_Prices. The table contains:
  TVModel (VARCHAR)   DateUpdated (DATETIME)   Price (MONEY) 

Unfortunately, I haven't been very consistent updating my data. Sometimes I've only updated prices for a few TVs, without bothering to update the full set.

Write a set of queries that result in a unique list of TV Models and the most recent price associated with each TV Model. Each TV Model should only occur in the result set once, and every TV Model I've ever priced should be present in the result set. The dataset should look like this:
TVModelMostRecentPrice
Sony x300$399.99
Samsung v100$599.99

So, if you can answer this question (ideally in your sleep), we'd love to hear from you.

4 responses

  1. Brian Mulisano Says:

    I believe I have a simple solution for this problem, I know it’s an old post on here but I can’t help but to solve a puzzle and it doesn’t look as though anyone else tried to solve it.

    My query I constructed based off of a table you describe: “select TVModel, Price, max(DateUpdated) as LastUpdate from T_Prices group by TVModel;”

    Cheers

  2. Tyler Says:

    For anyone who stumbles upon this page, the above post is wrong, it’s actually:

    SELECT TVModel, Price, DateUpdated FROM TPrices as T WHERE DateUpdated = ( select max(DateUpdated) from TPrices where TVModel= T.TVModel)

    The previous commenter’s SQL doesn’t return the correct prices associated with the newest record. And if you guys read through your comments, I like your style. I’m moving to Columbus shortly and am a web developer, do you accept applications from people who don’t drink?

  3. Innova Parters / Loosely Typed in Ohio Says:

    [...] example, did you know we have an excellent post that outlines our SQL interview question that so far nobody has answered correctly? No? [...]

  4. Innova Parters / Loosely Typed in Ohio Says:

    [...] the exceptional work of our team here at Innova. This week reminded me that the work we do to find and build the best team in the business is all worth it. I’m proud of everyone, especially [...]

Leave your mark

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Close
E-mail It
Socialized through Gregarious 42