Interview question to test beginner SQL competency?

  • Hello,

    I need to help my boss come up with a simple-ish SQL quiz. Myself and another analyst from our department are leaving and were the only two who know how to write queries. I am beginner level at best and I don't feel qualified to test someones capabilities. I received a job offer and when they found out i could write sql they gave me this quiz in access. (We use MSFT SQL server management server)

    SELECT userid, AVG(orderid), FROM tbl.companytable HAVING (orderid) > 0;

    "Whats wrong with this query?"

    Me - you need to partition orderid by userid otherwise you will get multiple user IDs and have the same average of all order IDs

    Them - right, so group by

    I want to do something like this, but cant really think of the best parameters in our DB to use, any advice on a simple query question to ask is greatly appreciated.

    My main goal is to not filter out a potentially good candidate just because i asked a poor question.

    Thanks in advance.

  • Sounds like a prelude to spam...  why would anyone in their right mind try to take an average on such an identifier column?  Really bad question and, since you say they say you got the answer right, I doubt their ability to form a decent question, as well.

    --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)

  • For introductory stuff, I always asked these questions. Obviously, a few would need to be updated, it being 2022 & all. However, I'd still say these were pretty basic, core stuff, to get a quick understanding of where someone's knowlege level is.

     

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • This was removed by the editor as SPAM

Viewing 4 posts - 1 through 3 (of 3 total)

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