• Knut Boehnert (2/7/2014)


    "How would you fill a coffee cup in T-SQL?" There is no straight right answer, more of a way of showing how the interviewee thinks and tackles a problem that is not as straightforward as an Inner Join.

    Kind of expected answer in case you wonder yourself:

    SELECT [Top 1] coffee INTO coffee.Cup FROM coffee.Machine

    I heard endless variations on this and it seems to be a question that makes nearly all T-SQL developers think hard.

    You're filling your coffee cup wrong! Every time you fill it, you end up with a new cup!

    Try using:

    UPDATE

    [coffeemug]

    SET

    [mug] = [coffeepot].[coffee]

    😀

    (Yeah, I know, cruddy T-SQL...)

    On topic: I've not run into any oddball interview questions, and quite glad I haven't. I'm way too literal-minded to put up with things like "how many manhole covers are there in the metro-Detroit area?" sort of thing (my answer would probably be either "one per manhole," or "how many haven't been stolen for scrap yet" depending on my mood)