Results 1 to 5 of 5
  1. #1
    Join Date
    Jan 2004

    Unanswered: SQL Interview Questions

    My department is hiring someone to build queries for reports in Hyperion. Our HR office is notorious for asking soft questions.

    The candidate does not need to be a high DBA...just someone with good knowledge of SQL (inner join, outter join, having, group by, count, case when, etc).

    Any recommendations on some questions to ask?

  2. #2
    Join Date
    Apr 2002
    Toronto, Canada
    here are a few questions off the top of my head...

    1. give a quick outline of the sql to remove all but one "duplicate" row
    answer: there are many ways, it depends on what you want done with the non-key values
    bonus marks: the interviewee says "duplicates aren't possible if the proper constraints have been defined" but then goes on to explain how to do it anyway
    demerit marks: the interviewee fails to say "first, take a backup"

    2. can you write a single query to get the top 3 salesmen per region
    answer: yes, of course
    bonus marks: the interviewee offers to write the query right there and then
    demerit marks: any hint of creating a temporary table or using a cursor

    3. describe the sequence of execution of query clauses
    bonus marks: the interviewee asks what difference it makes
    demerit marks: SELECT, FROM, WHERE, GROUP BY, HAVING, ORDER BY (obviously did not understand the question)

    4. should every table have an incremental integer primary key
    answer: no
    bonus marks: the interviewee describes which tables don't need one
    demerit marks: puzzled look suggesting this scenario has never crossed the interviewee's mind

    5. how would you do a full outer join?
    answer: with FULL OUTER JOIN syntax
    bonus marks: the interviewee gives the LEFT OUTER UNION RIGHT OUTER alternative
    demerit marks: the interviewee asks what a full outer join is | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Jan 2004
    Croatia, Europe
    Provided Answers: 4
    Whoa! Did you really do that off the top of your head?!? Being sleepless

  4. #4
    Join Date
    Feb 2007
    Bratislava, Slovakia
    perfect question is how many rows contains table dual
    a, 0
    b, 1
    c, 2
    d, 10
    Beer contains just a small amount of vitamines - that's why it's necessary to drink lot of it.

  5. #5
    Join Date
    Feb 2007
    Bratislava, Slovakia
    Hm... oracle provides several sample schema. one is HR. over this schema you can define lot of reports.
    for example: display first name, last name, salary, and hire date category.
    - up to one year
    - up to three years
    - more than three years

    nice selector are analytical function, for example LAG
    for example display, how many days is between hire date of two employees

    simple select you can tell more about new person than whole HR department and academic questions
    Beer contains just a small amount of vitamines - that's why it's necessary to drink lot of it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts