Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase «««23456»»

Index defaults 1 Expand / Collapse
Author
Message
Posted Thursday, June 14, 2012 3:58 PM
Mr or Mrs. 500

Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500

Group: General Forum Members
Last Login: Today @ 2:17 PM
Points: 586, Visits: 2,826
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.



Post #1316232
Posted Thursday, June 14, 2012 4:49 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 11:59 AM
Points: 5,916, Visits: 8,165
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
Post #1316239
Posted Thursday, June 14, 2012 5:17 PM
Mr or Mrs. 500

Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500

Group: General Forum Members
Last Login: Today @ 2:17 PM
Points: 586, Visits: 2,826

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.



Post #1316245
Posted Thursday, June 14, 2012 5:32 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 11:59 AM
Points: 5,916, Visits: 8,165
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
Post #1316249
Posted Thursday, June 14, 2012 6:36 PM


SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Wednesday, July 16, 2014 3:03 AM
Points: 450, Visits: 842
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.
Post #1316255
Posted Friday, June 15, 2012 9:26 AM


Say Hey Kid

Say Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey Kid

Group: General Forum Members
Last Login: Thursday, July 17, 2014 2:01 PM
Points: 687, Visits: 3,002
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
Post #1316732
Posted Monday, June 18, 2012 10:32 PM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Wednesday, May 28, 2014 5:42 PM
Points: 107, Visits: 81
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 :)
Post #1317714
Posted Friday, June 22, 2012 8:22 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Thursday, July 10, 2014 6:56 AM
Points: 1,176, Visits: 878
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".

Post #1319969
Posted Friday, June 22, 2012 8:34 AM
SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Wednesday, January 16, 2013 4:23 PM
Points: 415, Visits: 2,333
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

Post #1319983
Posted Friday, June 22, 2012 9:17 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 11:59 AM
Points: 5,916, Visits: 8,165
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
Post #1320032
« Prev Topic | Next Topic »

Add to briefcase «««23456»»

Permissions Expand / Collapse