• dogramone (6/14/2012)


    If the questions had said other constraints AND indexes were being added then it was a no brained "it depends".

    It is not possible to add indexes in a CREATE TABLE statement, except those that are implicitly created for PRIMARY KEY and UNIQUE constraints. If the question had said "other constraints and indexes", it would have been incorrect.

    I would not use this question in a job interview (though I might ask the candidate a more open question, e.g. "what kind of index will be created to support a PRIMARY KEY constraint", and then engage in dialog until I know whether he does or doesn't know this - and if he doesn't, that would not be a reason by itself to reject him). I might use it if I ever were to make an exam to assess a person's SQL Server skills. I believe that a good exam has a good mix of questions at different difficulty levels, to make sure that the result is a good measure of the candidate's competence. This question would be one of the hardest, that I expect only the best to get right.

    I am sorry that you felt tricked by this question. I tried hard to avoid that, and I sincerely apologise if you feel that I failed.

    I'll disregard the rest of your message, because it's bordering on ad-hom and I don't want to get involved in a flame war.


    Hugo Kornelis, SQL Server/Data Platform MVP (2006-2016)
    Visit my SQL Server blog: https://sqlserverfast.com/blog/
    SQL Server Execution Plan Reference: https://sqlserverfast.com/epr/