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


Query


Query

Author
Message
VALEK
VALEK
Ten Centuries
Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)

Group: General Forum Members
Points: 1222 Visits: 462
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
Iggy-SQL
Iggy-SQL
Hall of Fame
Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)

Group: General Forum Members
Points: 3245 Visits: 440
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
Carlo Romagnano
Carlo Romagnano
SSCertifiable
SSCertifiable (7.5K reputation)SSCertifiable (7.5K reputation)SSCertifiable (7.5K reputation)SSCertifiable (7.5K reputation)SSCertifiable (7.5K reputation)SSCertifiable (7.5K reputation)SSCertifiable (7.5K reputation)SSCertifiable (7.5K reputation)

Group: General Forum Members
Points: 7471 Visits: 3395
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. w00t

I run on tuttopodismo
ChiragNS
ChiragNS
SSCertifiable
SSCertifiable (6.6K reputation)SSCertifiable (6.6K reputation)SSCertifiable (6.6K reputation)SSCertifiable (6.6K reputation)SSCertifiable (6.6K reputation)SSCertifiable (6.6K reputation)SSCertifiable (6.6K reputation)SSCertifiable (6.6K reputation)

Group: General Forum Members
Points: 6609 Visits: 1865
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"
Lee Dilkes
Lee Dilkes
SSC Journeyman
SSC Journeyman (82 reputation)SSC Journeyman (82 reputation)SSC Journeyman (82 reputation)SSC Journeyman (82 reputation)SSC Journeyman (82 reputation)SSC Journeyman (82 reputation)SSC Journeyman (82 reputation)SSC Journeyman (82 reputation)

Group: General Forum Members
Points: 82 Visits: 99
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
gwalchers
gwalchers
SSC-Enthusiastic
SSC-Enthusiastic (132 reputation)SSC-Enthusiastic (132 reputation)SSC-Enthusiastic (132 reputation)SSC-Enthusiastic (132 reputation)SSC-Enthusiastic (132 reputation)SSC-Enthusiastic (132 reputation)SSC-Enthusiastic (132 reputation)SSC-Enthusiastic (132 reputation)

Group: General Forum Members
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.
Lloyd Bond-383166
Lloyd Bond-383166
SSC Journeyman
SSC Journeyman (79 reputation)SSC Journeyman (79 reputation)SSC Journeyman (79 reputation)SSC Journeyman (79 reputation)SSC Journeyman (79 reputation)SSC Journeyman (79 reputation)SSC Journeyman (79 reputation)SSC Journeyman (79 reputation)

Group: General Forum Members
Points: 79 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.
~paul hewitt
~paul hewitt
Ten Centuries
Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)

Group: General Forum Members
Points: 1111 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!)
Robert-378556
Robert-378556
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: 2342 Visits: 1010
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.
Hugo Kornelis
Hugo Kornelis
SSCoach
SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)

Group: General Forum Members
Points: 18677 Visits: 12426
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 BigGrin).


Hugo Kornelis, SQL Server MVP
Visit my SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis
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