how to answer interview question "what is the hardest sproc you have created?"

  • Jeff Moden (1/8/2015)


    Now, based on what I just said, one of my first questions on an SQL Server technical interview for DBAs and Developers alike is "How do you get the current date and time using T-SQL"? How would YOU answer that question?

    As a bit of a side bar, I'm mortified as to how many people actually come up with nothing (and I mean absolutely n-o-t-h-i-n-g) on that simple question. And, yes... I have been known to stop an interview right then and there when that happens.

    That's rather unprofessional. You can reduce the time for that interview, but you shouldn't summarily end it like that.

    I'm assuming this is a phone/screening interview. Because doing a face-to-face with someone who doesn't come close to a minimum level of requirements is a big waste of resources all around.

    SQL DBA,SQL Server MVP(07, 08, 09) "Money can't buy you happiness." Maybe so, but it can make your unhappiness a LOT more comfortable!

  • ScottPletcher (1/8/2015)


    Jeff Moden (1/8/2015)


    Now, based on what I just said, one of my first questions on an SQL Server technical interview for DBAs and Developers alike is "How do you get the current date and time using T-SQL"? How would YOU answer that question?

    As a bit of a side bar, I'm mortified as to how many people actually come up with nothing (and I mean absolutely n-o-t-h-i-n-g) on that simple question. And, yes... I have been known to stop an interview right then and there when that happens.

    That's rather unprofessional. You can reduce the time for that interview, but you shouldn't summarily end it like that.

    I'm assuming this is a phone/screening interview. Because doing a face-to-face with someone who doesn't come close to a minimum level of requirements is a big waste of resources all around.

    What's truly unprofessional is someone that claims 10 years of experience with SQL Server, T-SQL, and claims that they've been heavily involved in performance tuning of queries on their resume and then doesn't know how to get the current date and time using T-SQL. Rather than prolong their suffering and mine and burn an hour each of 3 other expensive resources in the room, it's better to end the interview when they can't answer such a basic question. It's like interviewing a mechanic. If you hold up a wrench, ask "what this", and they can't tell you, then they're not a mechanic and going any further is a total waste of time that would do nothing more than further humiliate the candidate that lied on their resume.

    And, to be clear, it's not where I abruptly state "This interview is over" and walk out. I do take the time to explain that I need someone that really knows T-SQL (or whatever) and that knowing dates and times is absolutely essential. But, if I did do such a thing, it would be totally justified because they totally lied on their resume.

    On the phone interview thing... I've recommended that they get me involved on the phone interviews to better filter the candidates so that such in-person tragedies can be avoided.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.
    "Change is inevitable... change for the better is not".

    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)
    Intro to Tally Tables and Functions

  • Luis Cazares (1/8/2015)


    Maddave (1/8/2015)


    Jeff Moden (1/8/2015)


    Now, based on what I just said, one of my first questions on an SQL Server technical interview for DBAs and Developers alike is "How do you get the current date and time using T-SQL"? How would YOU answer that question?

    I hope the answer is as simple as SELECT GETDATE() right?

    You got it completely wrong, you're thinking on dialect and we don't speak dialects, we use a general language called SQL which mandates uses CURRENT_TIMESTAMP according to ISO.

    OK, I'm just impersonating someone here to show you that is as simple as that but as complex as having 6 different options to get to the result. 😀

    Probably the best answer to this question IMHO would be to explain both GETDATE() and CURRENT_TIMESTAMP, including a short version of the pros and cons (without sounding condescending like the one Luis is imitating).

    There's a difference between technical and behavioral interview questions. The OPs is the latter while Jeff's is the former. It may be appropriate to produce short, direct, specific and accurate answers to technical questions. For behavioral questions interviewers are asking them to see what you did/how you responded/how you solved problems in past situations, so he can predict future behaviors on the basis that past behaviors are the best predictors of future behavior. Elaboration on these with specific cases that are directly related to the responsibilities of the role being interviewed for are most appropriate here.

    When I suggested the OP's question was "weird" I did it with full knowledge that oftentimes behavioral interview questions do sound kind of weird to those that are not trained in the approach.


    My mantra: No loops! No CURSORs! No RBAR! Hoo-uh![/I]

    My thought question: Have you ever been told that your query runs too fast?

    My advice:
    INDEXing a poor-performing query is like putting sugar on cat food. Yeah, it probably tastes better but are you sure you want to eat it?
    The path of least resistance can be a slippery slope. Take care that fixing your fixes of fixes doesn't snowball and end up costing you more than fixing the root cause would have in the first place.

    Need to UNPIVOT? Why not CROSS APPLY VALUES instead?[/url]
    Since random numbers are too important to be left to chance, let's generate some![/url]
    Learn to understand recursive CTEs by example.[/url]
    [url url=http://www.sqlservercentral.com/articles/St

  • dwain.c (1/8/2015)


    Luis Cazares (1/8/2015)


    Maddave (1/8/2015)


    Jeff Moden (1/8/2015)


    Now, based on what I just said, one of my first questions on an SQL Server technical interview for DBAs and Developers alike is "How do you get the current date and time using T-SQL"? How would YOU answer that question?

    I hope the answer is as simple as SELECT GETDATE() right?

    You got it completely wrong, you're thinking on dialect and we don't speak dialects, we use a general language called SQL which mandates uses CURRENT_TIMESTAMP according to ISO.

    OK, I'm just impersonating someone here to show you that is as simple as that but as complex as having 6 different options to get to the result. 😀

    Probably the best answer to this question IMHO would be to explain both GETDATE() and CURRENT_TIMESTAMP, including a short version of the pros and cons (without sounding condescending like the one Luis is imitating).

    There's a difference between technical and behavioral interview questions. The OPs is the latter while Jeff's is the former. It may be appropriate to produce short, direct, specific and accurate answers to technical questions. For behavioral questions interviewers are asking them to see what you did/how you responded/how you solved problems in past situations, so he can predict future behaviors on the basis that past behaviors are the best predictors of future behavior. Elaboration on these with specific cases that are directly related to the responsibilities of the role being interviewed for are most appropriate here.

    When I suggested the OP's question was "weird" I did it with full knowledge that oftentimes behavioral interview questions do sound kind of weird to those that are not trained in the approach.

    The key here is that I'm evaluating a whole bunch of things for every question I ask.

    1. Technical Knowledge

    2. Skill

    3. Experience

    4. Ability to communicate

    5. Fit

    You might balk at Technical Knowledge, Skill, and Experience being in three different categories but it's like when asking "What is a Tomato"? It's great that folks know that a Tomato is actually a fruit rather than a vegetable (Technical Knowledge) but it's even better when they also know that it usually doesn't work well in a fruit salad but works great on burgers (Skill) and aren't just taking someone's word for it because they've tried both (Experience) but also know that, with the addition of a little salt, it can be used to polish copper and the reasons why you shouldn't leave its juice or sauce in an aluminum pan overnight (very good in all 3 areas). If they go that far and do it the right way, they might also get high marks in the Ability to Communicate and Fit categories but could also score super low there depending on how they answer and how long it takes them to get the point across.

    Luis is right about the question. I'm not looking just for the simple "GETDATE" answer (although that would be refreshing considering how many people I've interviewed that don't even know that). I'm giving the interviewee the opportunity to strut their stuff and I do so on every question. I even coach them a bit if they "only" give me the flat "GETDATE" or "CURRENT_TIMESTAMP" answer and ask them are there any other methods and, if so, how they would decide on which one to use. If someone answered "There are 6 functions that do this but I normally use GETDATE because... and I use CURRENT_TIMESTAMP when ... " and they went on the "Tomato" side a bit about the date/time datatypes in the process, I'd fall out of my chair.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.
    "Change is inevitable... change for the better is not".

    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)
    Intro to Tally Tables and Functions

  • Jeff Moden (1/8/2015)


    dwain.c (1/8/2015)


    Luis Cazares (1/8/2015)


    Maddave (1/8/2015)


    Jeff Moden (1/8/2015)


    Now, based on what I just said, one of my first questions on an SQL Server technical interview for DBAs and Developers alike is "How do you get the current date and time using T-SQL"? How would YOU answer that question?

    I hope the answer is as simple as SELECT GETDATE() right?

    You got it completely wrong, you're thinking on dialect and we don't speak dialects, we use a general language called SQL which mandates uses CURRENT_TIMESTAMP according to ISO.

    OK, I'm just impersonating someone here to show you that is as simple as that but as complex as having 6 different options to get to the result. 😀

    Probably the best answer to this question IMHO would be to explain both GETDATE() and CURRENT_TIMESTAMP, including a short version of the pros and cons (without sounding condescending like the one Luis is imitating).

    There's a difference between technical and behavioral interview questions. The OPs is the latter while Jeff's is the former. It may be appropriate to produce short, direct, specific and accurate answers to technical questions. For behavioral questions interviewers are asking them to see what you did/how you responded/how you solved problems in past situations, so he can predict future behaviors on the basis that past behaviors are the best predictors of future behavior. Elaboration on these with specific cases that are directly related to the responsibilities of the role being interviewed for are most appropriate here.

    When I suggested the OP's question was "weird" I did it with full knowledge that oftentimes behavioral interview questions do sound kind of weird to those that are not trained in the approach.

    The key here is that I'm evaluating a whole bunch of things for every question I ask.

    1. Technical Knowledge

    2. Skill

    3. Experience

    4. Ability to communicate

    5. Fit

    You might balk at Technical Knowledge, Skill, and Experience being in three different categories but it's like when asking "What is a Tomato"? It's great that folks know that a Tomato is actually a fruit rather than a vegetable (Technical Knowledge) but it's even better when they also know that it usually doesn't work well in a fruit salad but works great on burgers (Skill) and aren't just taking someone's word for it because they've tried both (Experience) but also know that, with the addition of a little salt, it can be used to polish copper and the reasons why you shouldn't leave its juice or sauce in an aluminum pan overnight (very good in all 3 areas). If they go that far and do it the right way, they might also get high marks in the Ability to Communicate and Fit categories but could also score super low there depending on how they answer and how long it takes them to get the point across.

    Luis is right about the question. I'm not looking just for the simple "GETDATE" answer (although that would be refreshing considering how many people I've interviewed that don't even know that). I'm giving the interviewee the opportunity to strut their stuff and I do so on every question. I even coach them a bit if they "only" give me the flat "GETDATE" or "CURRENT_TIMESTAMP" answer and ask them are there any other methods and, if so, how they would decide on which one to use. If someone answered "There are 6 functions that do this but I normally use GETDATE because... and I use CURRENT_TIMESTAMP when ... " and they went on the "Tomato" side a bit about the date/time datatypes in the process, I'd fall out of my chair.

    Great Moden's Beard Jeff! If I'm ever hiring for a Chief Tomato Picker position I now know where to look! 🙂


    My mantra: No loops! No CURSORs! No RBAR! Hoo-uh![/I]

    My thought question: Have you ever been told that your query runs too fast?

    My advice:
    INDEXing a poor-performing query is like putting sugar on cat food. Yeah, it probably tastes better but are you sure you want to eat it?
    The path of least resistance can be a slippery slope. Take care that fixing your fixes of fixes doesn't snowball and end up costing you more than fixing the root cause would have in the first place.

    Need to UNPIVOT? Why not CROSS APPLY VALUES instead?[/url]
    Since random numbers are too important to be left to chance, let's generate some![/url]
    Learn to understand recursive CTEs by example.[/url]
    [url url=http://www.sqlservercentral.com/articles/St

  • As an antidote to Jeff's quick interview technique; the shortest one I ever had was for a contract position. My backside had barely touched the chair when the interviewer asked "It's a good CV - is it true?". I replied that it was and he said "The job's yours then. I'll soon find out if you're lying.". Even with me asking further questions to find out about the role, it was all over in under 20 minutes!

    I worked there for over 4 years in the end.

  • Probably the best answer to this question IMHO would be to explain both GETDATE() and CURRENT_TIMESTAMP, including a short version of the pros and cons (without sounding condescending like the one Luis is imitating).

    I always happy to admit when I don't know stuff, so this is a very interesting topic and I have definitely learnt something! 🙂

  • Chris Wooding (1/9/2015)


    As an antidote to Jeff's quick interview technique; the shortest one I ever had was for a contract position. My backside had barely touched the chair when the interviewer asked "It's a good CV - is it true?". I replied that it was and he said "The job's yours then. I'll soon find out if you're lying.". Even with me asking further questions to find out about the role, it was all over in under 20 minutes!

    I worked there for over 4 years in the end.

    I've had kind of the same thing happen to me. 2 hour "interview" with the "big guy" one-on-one. He never asked me any technical question. At the end, when he asked if I had any questions, I said "Yes Sir. Just one. We've been talking about the company for two hours and if we were the best of friends and you've asked my nothing technical. Why"? His answer was simple... "I've seen your resume... no one could make that s**t up but, just in case, I did Google you".

    I'm also not brutal with candidates that I interview. Sometimes very short but never brutal even with the obvious resume-liars. Most interviews go at least a half hour (provided they make it past the first question) and, if they're good, an hour or more simply because it's a joy to talk with a candidate that hasn't lied on their resume. So far, that ratio has been about 1 in 20 or so and I don't ask difficult, show-offy, esoteric, or oolie questions. Just the basics and if they're good, they volunteer other skills just in the normal conversation.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.
    "Change is inevitable... change for the better is not".

    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)
    Intro to Tally Tables and Functions

  • Jeff Moden (1/9/2015)


    Chris Wooding (1/9/2015)


    As an antidote to Jeff's quick interview technique; the shortest one I ever had was for a contract position. My backside had barely touched the chair when the interviewer asked "It's a good CV - is it true?". I replied that it was and he said "The job's yours then. I'll soon find out if you're lying.". Even with me asking further questions to find out about the role, it was all over in under 20 minutes!

    I worked there for over 4 years in the end.

    I've had kind of the same thing happen to me. 2 hour "interview" with the "big guy" one-on-one. He never asked me any technical question. At the end, when he asked if I had any questions, I said "Yes Sir. Just one. We've been talking about the company for two hours and if we were the best of friends and you've asked my nothing technical. Why"? His answer was simple... "I've seen your resume... no one could make that s**t up but, just in case, I did Google you".

    I'm also not brutal with candidates that I interview. Sometimes very short but never brutal even with the obvious resume-liars. Most interviews go at least a half hour (provided they make it past the first question) and, if they're good, an hour or more simply because it's a joy to talk with a candidate that hasn't lied on their resume. So far, that ratio has been about 1 in 20 or so and I don't ask difficult, show-offy, esoteric, or oolie questions. Just the basics and if they're good, they volunteer other skills just in the normal conversation.

    I always phone interview first with a canned set of REALLY basic questions. If you get past those, we'll come in and talk. And I'm also not mean in interviews. Although, if you tell me I'm wrong during the interview, you better be able to prove it. If you can't, I'm sure not nice, although I'm not mean. And I mention this because it's happened a bunch while interviewing, including a couple of times when I was the interviewee. I even had one company more or less show me the door because they thought I was wrong about something only to get a call back from them later, not with a job offer, but an apology.

    ----------------------------------------------------The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood... Theodore RooseveltThe Scary DBAAuthor of: SQL Server 2017 Query Performance Tuning, 5th Edition and SQL Server Execution Plans, 3rd EditionProduct Evangelist for Red Gate Software

  • I absolutely agree. A phone interview would be wonderful and every candidate is phone-interviewed first. The problem is that the people doing the phone interviews on our side know little about databases and really aren't qualified to do the phone interviews. It's something that I've been trying to get them to fix.

    There's also the problem of some folks Googling the "basic" questions and the people doing the phone interviews aren't correctly interpreting the line of nonsensical babble or silence that occurs while they Google the answer. There have been times where I have done the phone interview and they pass with flying colors. When "they" come in for the in-person interview, they crash and burn because it's not the same person that did the phone interview (and I usually pick up on that because of the change in voice). Even then, I don't lose my temper but if they don't pass the date/time question, I just end it in a manner that I previously stated. It's really hard to do that because I have a very strong hatred and total lack of respect for liars and posers. They're the bane of the industry.

    I do, however, tell the recruiter what went on because they've usually allowed themselves to be snowed by this idiots.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.
    "Change is inevitable... change for the better is not".

    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)
    Intro to Tally Tables and Functions

  • Jeff, thank you for the interview lead-in question about the current date--I am totally taking that!

    I've been doing phone technical interviews for database developers. My first technical question has been: "What is a clustered index and when would you use one?" Many of the interviewees have told me that they never encountered a situation in which they needed to use the "the clustered index feature." I still like that question, but the date question is a better lead-in.

    1 in 20 non-liars on the resume... totally snowed the recruiter... YES YES YES. I thought it was just me, but yes, that's been my experience as well. Again, thanks for proving that I am not going insane.

  • Stephanie Giovannini (1/9/2015)


    Jeff, thank you for the interview lead-in question about the current date--I am totally taking that!

    I've been doing phone technical interviews for database developers. My first technical question has been: "What is a clustered index and when would you use one?" Many of the interviewees have told me that they never encountered a situation in which they needed to use the "the clustered index feature." I still like that question, but the date question is a better lead-in.

    1 in 20 non-liars on the resume... totally snowed the recruiter... YES YES YES. I thought it was just me, but yes, that's been my experience as well. Again, thanks for proving that I am not going insane.

    Heh... either that or we're equally insane. 😀 My second question concerns clustered indexes (not exactly the same as yours but still easy). I used to ask these questions because I was sure that everyone would know them and it would give them a chance to easily get over the interview jitters they might have. Well, surprise, surprise, surprise! Who knew? :hehe:

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.
    "Change is inevitable... change for the better is not".

    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)
    Intro to Tally Tables and Functions

  • Chris Wooding (1/9/2015)


    As an antidote to Jeff's quick interview technique; the shortest one I ever had was for a contract position. My backside had barely touched the chair when the interviewer asked "It's a good CV - is it true?". I replied that it was and he said "The job's yours then. I'll soon find out if you're lying.". Even with me asking further questions to find out about the role, it was all over in under 20 minutes!

    I worked there for over 4 years in the end.

    Oh, I had one sorta like that. Never had a phone interview. Did have a little test from my recruiter. My recruiter, on the other hand, was a developer so grilled me pretty thoroughly before he put me forward for the job. Loved the fact that I had a SOHO and didn't go the boot camp route on my certs.

    I get to the company, two guys take me into the cafeteria. Ask me 3 or 4 basic questions. Then what's my experience with DTS? (I've looked at it, but haven't played with it), and then what's my experience with SQL Reporting Services (this was back in 2000 when it had just come out). I told them I had bought the dev edition of SQL and gotten the disk to install SSRS for free, so I played with it at home, but didn't have any real work experience with it.

    We spent the next 5 minutes discussing video games and MUSHes. Because I did volunteer coding work on a MUSH, so added it to my very thin resume to pad out a little. And they had a developer who actually was coding his own video game. That 5 minutes was pretty fun.

    Then they said goodbye. Didn't take me around and show me the work place. Didn't introduce me to anyone. I got in my car and called the recruiter to tell them my 10-15 minute interview was a bust. We barely talked about ANYTHING. I was almost in tears.

    "Wait right there," I was told. "I'll call you back in a few minutes."

    5 minutes later, the recruiter calls me back. "You start on Monday. Be there at 8 a.m."

    Almost 10 years later, I'm still here. I've been through 5 managers and the last one keeps telling me that I'm not allowed to leave because I have too much institutional knowledge. He keeps threatening to promote me to manager so I can take all the meetings and he can do all the SQL work. I choose to take that as a compliment. @=)

    Brandie Tarvin, MCITP Database AdministratorLiveJournal Blog: http://brandietarvin.livejournal.com/[/url]On LinkedIn!, Google+, and Twitter.Freelance Writer: ShadowrunLatchkeys: Nevermore, Latchkeys: The Bootleg War, and Latchkeys: Roscoes in the Night are now available on Nook and Kindle.

  • Brandie Tarvin (1/9/2015)


    I've been through 5 managers...

    BWAAAA-HAAAAA-HAAAA!!!! You must be tough on managers! :-D:-P

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.
    "Change is inevitable... change for the better is not".

    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)
    Intro to Tally Tables and Functions

  • Jeff Moden (1/9/2015)


    Brandie Tarvin (1/9/2015)


    I've been through 5 managers...

    BWAAAA-HAAAAA-HAAAA!!!! You must be tough on managers! :-D:-P

    I'm finishing up my fourth year at Redgate and I'm on my fourth manager. Youngsters these days. No staying power at all.

    ----------------------------------------------------The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood... Theodore RooseveltThe Scary DBAAuthor of: SQL Server 2017 Query Performance Tuning, 5th Edition and SQL Server Execution Plans, 3rd EditionProduct Evangelist for Red Gate Software

Viewing 15 posts - 16 through 30 (of 32 total)

You must be logged in to reply to this topic. Login to reply