June 25, 2012 at 11:20 pm
Haven't used NULLIF before, so I learned something.
Small error: the select statement selects 4 columns, the answers have only 3.
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
June 26, 2012 at 12:30 am
One more function added in my memory DB 🙂
--rhythmk
------------------------------------------------------------------
To post your question use below link
https://www.sqlservercentral.com/articles/forum-etiquette-how-to-post-datacode-on-a-forum-to-get-the-best-help
🙂
June 26, 2012 at 12:32 am
Koen Verbeeck (6/25/2012)
Haven't used NULLIF before, so I learned something.Small error: the select statement selects 4 columns, the answers have only 3.
Nice observation Koen 🙂
--rhythmk
------------------------------------------------------------------
To post your question use below link
https://www.sqlservercentral.com/articles/forum-etiquette-how-to-post-datacode-on-a-forum-to-get-the-best-help
🙂
June 26, 2012 at 12:34 am
badly formed answers
you are selecting 4 columns in your question (ID, Y, Test1, Test2) yet your answers and the supposed "correct" one only has 3
June 26, 2012 at 12:46 am
imarran (6/26/2012)
badly formed answersyou are selecting 4 columns in your question (ID, Y, Test1, Test2) yet your answers and the supposed "correct" one only has 3
Say, not optimal, but if you read the complete task 'The values are listed as ID, TEST1, TEST2. For example: 1, 3, 0', then it should be clear.:-P
I searched the trick behind the question, but found nothing, so all 4 selected, and won a point. Thx!
June 26, 2012 at 12:59 am
Koen Verbeeck (6/25/2012)
Small error: the select statement selects 4 columns, the answers have only 3.
BIG ERROR: I answered thinking at the first 3 columns, so that Y would return without conversion.
June 26, 2012 at 1:04 am
Yes i Agree,
However in second line of question, following is also mentioned.
"The values are listed as ID, TEST1, TEST2. For example: "
So reading full question and all details can avoid such confusions.
Cheers
June 26, 2012 at 1:32 am
Caught me out there, I returned 3 of the 4 correct answers. 2,NULL,0 I thought is not valid. Well done.
---
Note to developers:Want to get the best help? Click here https://www.sqlservercentral.com/articles/forum-etiquette-how-to-post-datacode-on-a-forum-to-get-the-best-help (Jeff Moden)
My blog: http://uksqldba.blogspot.com
Visit http://www.DerekColley.co.uk to find out more about me.
June 26, 2012 at 1:42 am
Is the goal of the question to catch people out or test SQL skill and knowledge?
June 26, 2012 at 1:47 am
I was confused due to the lack of the correct number of columns.
June 26, 2012 at 2:08 am
A great topic to test knowledge, but I think it kind of gets lost within the context of the question! :hehe:
What is the point of the tricks in the question (result at the start, and four columns in the select, with three in the answer) when trying to test a certain functionality, along with having the column X in the mix?
June 26, 2012 at 2:36 am
I'd agree with Michael--this question seemed to be unnecessarily obfuscated and was more about reading comprehension than anything SQL related, IMHO.
June 26, 2012 at 4:33 am
I've been caught out on the QotD before by not reading the question properly, but I agree that the SQL being different to the actual quesiton seemed a little overly confusing.
However, as there's 4 records in the table, regardless of knowledge of the NULLIF function surely the output was always going to be all 4 options?
Perhaps to test knowledge of NULLIF, the question might have been better to include NULLIF as a where clause, something like:
select
id,
nullif(y,0) as 'test 1',
nullif(y,9) as 'test 2'
from
#whatif
where
nullif(y,0) is null
or nullif(y,9) is null
and then have the same 4 answers with a "Check all that apply" option?
June 26, 2012 at 5:16 am
Koen Verbeeck (6/25/2012)
Haven't used NULLIF before, so I learned something.Small error: the select statement selects 4 columns, the answers have only 3.
😉
Viewing 15 posts - 1 through 15 (of 52 total)
You must be logged in to reply to this topic. Login to reply