Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Index defaults 1


Index defaults 1

Author
Message
dogramone
dogramone
SSChasing Mays
SSChasing Mays (630 reputation)SSChasing Mays (630 reputation)SSChasing Mays (630 reputation)SSChasing Mays (630 reputation)SSChasing Mays (630 reputation)SSChasing Mays (630 reputation)SSChasing Mays (630 reputation)SSChasing Mays (630 reputation)

Group: General Forum Members
Points: 630 Visits: 3621
Trick questions are the reason I rearely bother with QOD. It woudl be great to learn things but when there is so little information and only a mention of other constraints being added not indexes of course the SQL default behaviour is expected. If the questions had said other constraints AND indexes were being added then it was a no brained "it depends". So I think is was a badley worded question that was ensuring a high failure rate.

Editied to remove stroppy and inappropriate comments.



Hugo Kornelis
Hugo Kornelis
SSCrazy Eights
SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)

Group: General Forum Members
Points: 8337 Visits: 11580
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 MVP
Visit my SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis
dogramone
dogramone
SSChasing Mays
SSChasing Mays (630 reputation)SSChasing Mays (630 reputation)SSChasing Mays (630 reputation)SSChasing Mays (630 reputation)SSChasing Mays (630 reputation)SSChasing Mays (630 reputation)SSChasing Mays (630 reputation)SSChasing Mays (630 reputation)

Group: General Forum Members
Points: 630 Visits: 3621
Hugo, Sorry if you thought I was trying to enter into a flame war, that was not the intent.

To all others that have read my previous post and feel I was laying it on thick against Hugo, that was not my intent. I have been a member here for about a decade and have read many posts and articles written by Hugo and have learnt a lot of very valuble information from him. I see Hugo as one of the "heros" on this site along with Jeff, Gail, Lyn, Paul to name but a few. I highly respect Hugo's knowledge and capabilities and would be willing to blindly follow any suggestion or recommendation that Hugo makes as I know he has knowledge and experience to make best practices recommendations.



Hugo Kornelis
Hugo Kornelis
SSCrazy Eights
SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)

Group: General Forum Members
Points: 8337 Visits: 11580
dogramone (6/14/2012)

Hugo, Sorry if you thought I was trying to enter into a flame war, that was not the intent.

To all others that have read my previous post and feel I was laying it on thick against Hugo, that was not my intent. I have been a member here for about a decade and have read many posts and articles written by Hugo and have learnt a lot of very valuble information from him. I see Hugo as one of the "heros" on this site along with Jeff, Gail, Lyn, Paul to name but a few. I highly respect Hugo's knowledge and capabilities and would be willing to blindly follow any suggestion or recommendation that Hugo makes as I know he has knowledge and experience to make best practices recommendations.

Thanks for clarifying that you didn't intend your message to be a personal attack. And thanks for the kind words about me (and many others).
The only thing I want to add to this, is to please NEVER follow my suggestions blindly (or anyone's suggestions). Everyone is human, everyone makes mistakes. Always check on all advise you get. 'kay? ;-)


Hugo Kornelis, SQL Server MVP
Visit my SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis
davoscollective
davoscollective
SSChasing Mays
SSChasing Mays (605 reputation)SSChasing Mays (605 reputation)SSChasing Mays (605 reputation)SSChasing Mays (605 reputation)SSChasing Mays (605 reputation)SSChasing Mays (605 reputation)SSChasing Mays (605 reputation)SSChasing Mays (605 reputation)

Group: General Forum Members
Points: 605 Visits: 1000
Trick question is not quite the right description of this.

I was one of the "myth" believers and now I've learned something. Whilst it might have been a bit painful getting it wrong and in retrospect a bit obvious if I had read it more carefully, it was certainly effective. Learning from mistakes is what life is all about.
Rich Mechaber
Rich Mechaber
Ten Centuries
Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)

Group: General Forum Members
Points: 1087 Visits: 3661
Thanks for the question Hugo, and more thanks for your inevitably thorough follow-up explanations and replies to objections.

I got it wrong in the "best way possible" which for me is just fine: like others who've replied, I usually explicitly create constraints and keys after table creation.

To my mind, this kind of behavior is akin to the default length of 1 when declaring a VARCHAR() without explicitly setting a length. If I keep to a standardized way of doing things explicitly, I don't have to remember obscure exceptions to expected behavior.

Rich
andy mack
andy mack
SSC-Enthusiastic
SSC-Enthusiastic (126 reputation)SSC-Enthusiastic (126 reputation)SSC-Enthusiastic (126 reputation)SSC-Enthusiastic (126 reputation)SSC-Enthusiastic (126 reputation)SSC-Enthusiastic (126 reputation)SSC-Enthusiastic (126 reputation)SSC-Enthusiastic (126 reputation)

Group: General Forum Members
Points: 126 Visits: 87
Thanks Hugo. A challenging question that really got me thinking.

I initially got my back up over its wording but, after reading your reasons behind the question, I have come around to your way of thinking Smile
Robert-378556
Robert-378556
SSCommitted
SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)

Group: General Forum Members
Points: 1570 Visits: 1007
Any answer can be valid as anything unspecified can follow - any alter table, drop table, even drop database.
It's like a question "Guess what I'm thinking about".
patrickmcginnis59
patrickmcginnis59
SSC-Addicted
SSC-Addicted (431 reputation)SSC-Addicted (431 reputation)SSC-Addicted (431 reputation)SSC-Addicted (431 reputation)SSC-Addicted (431 reputation)SSC-Addicted (431 reputation)SSC-Addicted (431 reputation)SSC-Addicted (431 reputation)

Group: General Forum Members
Points: 431 Visits: 2333
Robert-378556 (6/22/2012)
Any answer can be valid as anything unspecified can follow - any alter table, drop table, even drop database.
It's like a question "Guess what I'm thinking about".



"If I execute a batch that contains only the CREATE TABLE statement"

Implies that there is only the create statement. We were shown part of the statement.

For what its worth I answered incorrectly, selecting the clustered index. But then again I miss too many questions to be terribly bothered by one more red x ;-)
Hugo Kornelis
Hugo Kornelis
SSCrazy Eights
SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)

Group: General Forum Members
Points: 8337 Visits: 11580
Robert-378556 (6/22/2012)
Any answer can be valid as anything unspecified can follow - any alter table, drop table, even drop database.
It's like a question "Guess what I'm thinking about".

That's why I explicitly included that I execute a batch that only includes the CREATE TABLE statement. That rules out ALTER TABLE, DROP TABLE, DROP DATABASE, and a whole bunch of other options.


Hugo Kornelis, SQL Server MVP
Visit my SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search