June 23, 2008 at 7:44 am
If you look at the output required, then Option 2 should be the correct. Option 3 will also result the NULLs at end but it doesn't return the result as per the output required....I strongly believe Option 2 is the correct one.
June 23, 2008 at 7:55 am
If this is the question "have list off all employees with the employees with DateOfLeaving coming last and all others sorted ascending order of date of leaving, Name sorted in ascending order for each group" , I read this as having those without a DateOfLeaving coming first which means number 1 should be the correct answer.
June 23, 2008 at 7:57 am
Steven Cameron (6/23/2008)
When the question of the day is incorrect, everyone keeps posting the same thing over and over. Maybe we should have a standard reply form:-------------------------------------------------------------------------------
I selected A B C D E (circle all that apply) but the explanation said that I was wrong even though my answer was correct.
These questions should be Reviewed Tested Edited Read (circle all that apply) before being posted.
I want my points
____ Added to my account
____ Donated to starving children in _____
____ I don't care about my points
-------------------------------------------------------------------------------
:D:P:D:P:D:P:D LOVE THIS! Really, I just posted to make sure I got my point that I felt I should have gotten to begin with, and now I have 2! Woo! :hehe: In my 3 years on this site, I have never seen points added after the fact to people that were supposedly "incorrect" so I don't have a lot of faith that will happen in this case either. Gotta take matters into your own hands if you want those points!
That being said, I do find the site incredibly informative in many other cases even though the QOTD can be very frustrating at times. The forum posts on them are always worth a giggle. 🙂
June 23, 2008 at 8:02 am
I am sure that only second answer is correct and its only one choice.
--Execute this query to see the result
declare @t table(EmpName varchar(100), DateOfLeaving datetime)
insert into @t
Select 'Abc','10-10-1999' UNION
Select 'Bcd','11-11-1998' UNION
Select 'Ccd', null UNION
Select 'Dcd','08-10-2000' UNION
Select 'Eed', null
Select EmpName, DateOfLeaving from @t order by isnull(DateOfLeaving,'10/10/9999'),EmpName asc
Select EmpName, DateOfLeaving from @t order by DateOfLeaving desc, EmpName asc
June 23, 2008 at 8:07 am
Not to be picky but the T-SQL in answer #2 is:
Select EmpName, DateOfLeaving from Employees order by isnull(DateOfLeaving,’10/10/9999'),EmpName asc
Now notice the single quotation marks surrounding 10/10/9999.
Executing the statement AS GIVEN results in:
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near '’'.
Since the SQL statement will NOT execute how can it possibly be a correct answer?
June 23, 2008 at 8:08 am
If you persist you get the points back, and it seems reasonably often. Doesn't help the bragging rights though, as you get the points added to QotD totals but not to the standings. I current have 10 more points on my totals then in the standings!!!
Never mind it's all good fun and normally very informative.
June 23, 2008 at 8:13 am
This is despicable - a QOTD where the supposedly correct answer is quite clearly incorrect, unless you happen to take an extraordinarily ODD interpretation of the question and assume that the dates are a TEXT field. I honestly think that all the responses so far have been entirely too timid in terms of taking the site admin to task for EVER allowing such a thing to occur. Yes, we are all human, but there is a thing called responsibility, which, despite the nature of humanity, IS indeed ABSOLUTE. Sorry folks, but this kind of thing really IS inexcusable, when it's blatantly obvious that a rather simple process called proofreading can eliminate the problem. Placing content online DOES require that kind of responsibility.
Anything less than excising the incorrect answers from everyone's track record AND providing the missed points to all those having answered it correctly (as the 2nd answer only), will also be "inexcusable". Oh, and while you're at it, stop allowing the question to get any more answers.
Get 'er done... and hurry the heck up about it too...
Steve
(aka smunson)
:angry::angry::angry:
Steve (aka sgmunson) 🙂 🙂 🙂
Rent Servers for Income (picks and shovels strategy)
June 23, 2008 at 8:19 am
Iggy (6/22/2008)
antony (6/22/2008)
I also picked option 2, only to be told I was wrong, and should have picked option 2!:crying:I think you misread the answer. The answer according to the author is 2 and 3. It's the way it's displayed seems to be just a single answer.
Question
The question is to have list off all employees with the employees with DateOfLeaving coming last and all others sorted ascending order of date of leaving, Name sorted in ascending order for each group.
The results from query #3 are sorted in descending order by date.
June 23, 2008 at 8:36 am
Me too. I selected the second answer and it said that I was wrong. Then it says the correct answer is the one I selected. What is going on here???
June 23, 2008 at 8:52 am
William Strutts (6/23/2008)
Me too. I selected the second answer and it said that I was wrong. Then it says the correct answer is the one I selected. What is going on here???
It says that answer 2 and 3 are the correct answers, the 2 answers have been put onto the one line.
June 23, 2008 at 8:53 am
smunson (6/23/2008)
This is despicable - a QOTD where the supposedly correct answer is quite clearly incorrect, unless you happen to take an extraordinarily ODD interpretation of the question and assume that the dates are a TEXT field. I honestly think that all the responses so far have been entirely too timid in terms of taking the site admin to task for EVER allowing such a thing to occur. Yes, we are all human, but there is a thing called responsibility, which, despite the nature of humanity, IS indeed ABSOLUTE. Sorry folks, but this kind of thing really IS inexcusable, when it's blatantly obvious that a rather simple process called proofreading can eliminate the problem. Placing content online DOES require that kind of responsibility.Anything less than excising the incorrect answers from everyone's track record AND providing the missed points to all those having answered it correctly (as the 2nd answer only), will also be "inexcusable". Oh, and while you're at it, stop allowing the question to get any more answers.
Get 'er done... and hurry the heck up about it too...
Steve
(aka smunson)
:angry::angry::angry:
Remember the old adage -
Let he who is without sin cast the first stone.
:DLots of innocents here today!:D
June 23, 2008 at 8:59 am
Nick Beagley (6/22/2008)
i was sure i chose the 2nd one and was suprised when i got it wrong. But it said the correct answer was the one i thought i selected (the 2nd). So i pressed back in my browser and it was the 2nd one that i had ticked.oh well..
The same thing happened to me.
-Joseph
June 23, 2008 at 9:05 am
Actually, that "old adage" has a rather seriously gaping hole in it - such that it renders ALL judgements invalid simply because everyone is imperfect. A total lack of judgement is a far more serious problem than that of casting stones, especially when you consider the number of innocents...
Steve
(aka smunson)
:):):)
Tom Garth (6/23/2008)
Remember the old adage -Let he who is without sin cast the first stone.
:DLots of innocents here today!:D
Steve (aka sgmunson) 🙂 🙂 🙂
Rent Servers for Income (picks and shovels strategy)
June 23, 2008 at 9:08 am
How other members answered
Correct answers: 5% (55)
Incorrect answers: 95% (952)
Total attempts: 1007
Hey look at this stat according to SQLServerCentral.com poll about this Sort Order - Include Null al last, by Sajeev SL...
There's a lot bunch of idiots here in SQLServerCentral.com.... (Just kidding)
June 23, 2008 at 9:17 am
The third answer is not correct. I had to go back and do some testing on one of our tables that does contain date data. Only the 2nd option returns the result set as requested in the question.
Viewing 15 posts - 46 through 60 (of 138 total)
You must be logged in to reply to this topic. Login to reply