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 ««12345»»»

Query Expand / Collapse
Author
Message
Posted Monday, April 7, 2008 1:12 AM


Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Tuesday, December 10, 2013 10:06 PM
Points: 374, Visits: 428
Jignesh Mehta (4/6/2008)
The question ask only for those employees Who joined in the month of Jan, Feb, March, April, May, Aug from table employee having a field of join_date where as the correct answers tells that "month(dob) in (1,2,3,4,5,8)" will also give the required data which is not correct. (normally "dob" denotes to Date of Birth)

The other answer " datename(m,join_date) like '%a%' " is also not correct as it will not give the list of employees who joined in the month of FEB

Since both " month(dob) in (1,2,3,4,5,8), datename(m,join_date) like '%a%' " answer are not correct, the last answer "Not in List" is the correct answer.

I nee my points.

datename(m,..) will return "February" for the FEB dates, so like '%a%' will return it.
see here
The problem is with the typo "dob"...


M.Sc.IT, M.B.A, MCTS BI 2008, MCITP BI 2008, MCTS SQL Dev, CSM, CDVDM
Post #480619
Posted Monday, April 7, 2008 1:18 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Friday, September 19, 2014 2:26 AM
Points: 2,953, Visits: 439
The QotD seems to be getting a lot of mistakes lately. I didn't pick A because of the "dob" field, and didn't pick B as well from not thinking well enough. So I pick C. Hence half is my mistake, so I'm happy to forego my points. But still, the question could have been better.


Urbis, an urban transformation company
Post #480622
Posted Monday, April 7, 2008 1:25 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: 2 days ago @ 12:49 AM
Points: 2,620, Visits: 2,467
I couldn't believe that someone need to use "datename(m,join_date) like '%a%'" to extract rows of Jan, Feb, March, April, May, Aug.
Post #480625
Posted Monday, April 7, 2008 2:09 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Tuesday, September 23, 2014 8:08 AM
Points: 2,365, Visits: 1,846
Hi

So what do we do when the questions go wrong. Can the points be given to people who have chosen the "RIGHT" answer.



"Keep Trying"
Post #480632
Posted Monday, April 7, 2008 2:13 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Tuesday, October 21, 2014 7:42 AM
Points: 47, Visits: 96
The first option specifies a column called dob.
This was not mentioned in the question therefore I believe I answered correctly.

Please credit me with my points
Post #480634
Posted Monday, April 7, 2008 2:29 AM
SSC-Enthusiastic

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

Group: General Forum Members
Last Login: Thursday, May 27, 2010 4:35 AM
Points: 132, Visits: 15
hmm, suprised to see mistakes in the question/answer. Might not bother answering them if they are not more accurately checked before being used.
Post #480636
Posted Monday, April 7, 2008 2:30 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Tuesday, May 25, 2010 4:38 AM
Points: 23, Visits: 67
Um, again I'll chorus with the rest:

month(dob) in (1,2,3,4,5,8) - dob???? It doesn't exist, did you mean join_date? Sorry but you're wrong.

datename(m,join_date) like '%a%' - fair does, I cocked up Feb being february, a very sneaky question.
Post #480637
Posted Monday, April 7, 2008 2:37 AM
SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Tuesday, January 17, 2012 2:51 AM
Points: 935, Visits: 251
Would it be fair that when a qotd is published and then found to be faulty, to admit that there was a mistake with the question and then cancel it? e.g. Just give everyone who answered zero points, and mark all replies as correct no matter what answer was given. Or any other method you prefer that does not mess up people's stats (and requires minimal programming!)
Post #480639
Posted Monday, April 7, 2008 2:46 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Thursday, November 20, 2014 4:37 AM
Points: 1,275, Visits: 932
Points don't matter. QoD is supposed to fun way of learning something new (you're wrong) or prove your knowledge (you're right and awarded with points).

Questions like this spoil the fun. Re-awarding later like the case with yobibyte doesn't make it taste better. Though it was common knowledge that kilobyte=1024 bytes does not conform to SI standard, I didn't know it was forbidden. Hard drive makers already use it, as it serves them better, software afaik uses 1024 formula.

I prefer learning something new as it serves the fun, my work and my career better.
Post #480642
Posted Monday, April 7, 2008 2:47 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 3:35 AM
Points: 6,133, Visits: 8,397
Hi all,

In contrast to some other people in this discussion (and in many other QotD related discussions), I really don't care about points. Points are just a fun way to attract more audience to what should be a mix of fun and education. And the latter (the educational part) is what worries me when I see incorrect answers being marked as correct - and worries me even more when I see absolute bad practices being advertised as a correct answer, without even a disclaimer that this should never be done in a real system.

If you were a DB developer in the US and you built your query around the letter a being or not being in the name of the month, I'd fire you immediately. Many other countries have better job protection, but in those other countries, this code wouldn't even pass the first tests, since most languages seem to have different letters in some of the month names. (And for the record, the code using LIKE '%a%' would also fail on any English server with a case sensitive collation, as neither April nor August contains a lowercase a character).

The error with dob instead of hire_date is just an unfortunate error. Stuff like that happpens. It's a bit unfortunate in that people start doubting whether it's a deliberate setup to check how careful you read the answers or an oversight - but that's nothing one should worry about. If that were the only problem with today's QotD, I wouldn't even have bothered to post.

But the date selection on a letter in a month name - that's just terrible. The following thiings are wrong with it:
* Code relies on language settings and case sensitivity and is hence very unreliable
* Code is unnecessary hard to understand, making future maintenance a nightmare
* I didn't test to confirm, but I expect this code to be slower than the MONTH(...) IN (...) version.

Once more - for the first reason alone, I'd terminate your contract immediately if I were your boss and we were in a country where there are no laws against such termination; for the latter two reasons, I would not terminate you but have a long and stern talk about coding for future maintenance and coding for performance. (And the jury is still out on whether that might be a harsher punishment that immediiate termination :D).



Hugo Kornelis, SQL Server MVP
Visit my SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis
Post #480643
« Prev Topic | Next Topic »

Add to briefcase ««12345»»»

Permissions Expand / Collapse