SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


How many Records Will Get Selected


How many Records Will Get Selected

Author
Message
bazzkar
bazzkar
SSC-Enthusiastic
SSC-Enthusiastic (182 reputation)SSC-Enthusiastic (182 reputation)SSC-Enthusiastic (182 reputation)SSC-Enthusiastic (182 reputation)SSC-Enthusiastic (182 reputation)SSC-Enthusiastic (182 reputation)SSC-Enthusiastic (182 reputation)SSC-Enthusiastic (182 reputation)

Group: General Forum Members
Points: 182 Visits: 72
Comments posted to this topic are about the item How many Records Will Get Selected
Kingston Dhasian
Kingston Dhasian
SSCarpal Tunnel
SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)

Group: General Forum Members
Points: 4187 Visits: 5244
Another Trick Question that is sure to generate quite a bit of debate. You dont learn anything new, and lose 3 points. I am sure many would be knowing the answer but will choose the wrong option because of the construction of the question. I would suggest to put such questions under a different criteria called TRICK QUESTION or something so that people dont feel fooled.


Kingston Dhasian

How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/
SQLRNNR
SQLRNNR
SSC-Forever
SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)

Group: General Forum Members
Points: 40369 Visits: 18565
I don't see this as a trick question. I see it as a good question. There is something to be learned from this question and thus it is worthwhile.

Thanks for the QOD.



Jason AKA CirqueDeSQLeil
I have given a name to my pain...
MCM SQL Server, MVP


SQL RNNR

Posting Performance Based Questions - Gail Shaw

malleswarareddy_m
malleswarareddy_m
SSCrazy
SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)

Group: General Forum Members
Points: 2345 Visits: 1189
Hi i know this answer it was syntax wrong but i put 1 as wrong anwer.

because i thought that there may wrong with script.I know that this script will give sytax error.But i thought that there is some print mistake.

then i correct it to.

Alter table mytable with check Add constraint[checkmainvalue] check(([mainvalue])> (0))

then executed.this gives me 1 as result.because the conditon satisfied for 1 only.

This question is not difficulty.it divorsed me to put wrong anwer.There is nothing new learn from this question.

Malleswarareddy
I.T.Analyst
MCITP(70-451)
Christian Buettner-167247
Christian Buettner-167247
SSCarpal Tunnel
SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)

Group: General Forum Members
Points: 4085 Visits: 3889
Hm, looks like I misinterpreted the intention of the author.
My assumption was, that the question was about whether an error in one of the INSERT operations aborts the full batch. I did see the missing parentheses, but since there have been so many erroneous questions in the past, I also considered this one to be an error of the author.
Well, better luck next time...

Best Regards,

Chris Büttner
Carlo Romagnano
Carlo Romagnano
SSCertifiable
SSCertifiable (5.8K reputation)SSCertifiable (5.8K reputation)SSCertifiable (5.8K reputation)SSCertifiable (5.8K reputation)SSCertifiable (5.8K reputation)SSCertifiable (5.8K reputation)SSCertifiable (5.8K reputation)SSCertifiable (5.8K reputation)

Group: General Forum Members
Points: 5830 Visits: 3340
There is nothing new learn from this question.

The lesson is:
"GO" may be dangerous if no error checking is done!

I run on tuttopodismo
Kingston Dhasian
Kingston Dhasian
SSCarpal Tunnel
SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)

Group: General Forum Members
Points: 4187 Visits: 5244
CirquedeSQLeil (6/10/2010)
I don't see this as a trick question. I see it as a good question. There is something to be learned from this question and thus it is worthwhile.

Thanks for the QOD.


I agree there may be some who might learn something from the question. A definite good question for them no doubt. But i thought the question had a typo and selected the wrong answer. How do i know if the syntax error was deliberate or just a mistake? We have had instances in the past where it was just a typo.

The first thing i do when i come to office is open my SSMS and then SSC QOTD. And when something like this happens it definitely irritates you a bit. Same happened with me.


Kingston Dhasian

How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/
Hugo Kornelis
Hugo Kornelis
SSChampion
SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)

Group: General Forum Members
Points: 13141 Visits: 12176
I do not like this kind of question at all. The QotD should be a learning opportunity, with clear questions and no tricks.

There is nothing to be learned from this question. In a real situation, the error in the syntax would be obvious as soon as the code is executed, and it would be corrected before users get to add data.

The lesson is:
"GO" may be dangerous if no error checking is done!

If that was the intended lesson, then the example is very badly chosen. Come on! How realistic is a script that adds a constraint and then immediately adds some data that obviously violates that constraint. I can only envisage that in a test database, where someone wants to test if constraints work as expected (not a bad idea, especially if NULL values are involved) - but in that case, checking the test output would immediately expose the problem and allow the developer to correct it. Which is the very purpose of running a test script.

Another problem I have is that this kind of questions call for psychic powers on our part. Others have already commented that it might have been a honest mistake by the author, and we are suppose to answer based on a succesfull constraint creation (such errors and expectation have occured in the past).
A problem not yet pointed out, but relevant in this and many other questions, is case sensitivity. Even if the missing parentheses are added, the constraint would still not be created in my test database, since I run a case sensitive collation (so "mytable" is not the same as "MyTable"). Other people will use different collations, and hence get a different result. How am I suppose to know what the author had in mind?

This all being said, I'd still like to say "thank you" to bazzkar for contributing this question. Please take my reaction as it's intended, as constructive feedback. Don't let it discourage you from contributing more questions in the future, but do keep the feedback in mind to make your future questions better.


Hugo Kornelis, SQL Server MVP
Visit my SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis
Toreador
Toreador
Hall of Fame
Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)

Group: General Forum Members
Points: 3122 Visits: 8088
Well I learnt something, though probably not what was intended.

Believe it or not, I never realised that identity columns are ignored if you could insert into a table using that syntax, ie not giving a column list. I've always coded such things as
insert into MyTable (mainvalue) values (-1)
on the assumption that otherwise it would give an error about fewer values than columns!
george sibbald
george sibbald
SSChampion
SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)

Group: General Forum Members
Points: 13056 Visits: 13695
Its a trick question that encourages people to just cut and paste and see what happens.

the question appears to be on how constraints work but is in effect testing your knowledge of syntax (or ability to cut and paste). Who remembers all details of syntax?

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