November 7, 2013 at 10:48 pm
Comments posted to this topic are about the item Using Max()
Developer, DBA, Pre-Sales consultant.
November 7, 2013 at 10:50 pm
Very good question - got caught out with as well. Should have realized that with out the where clause that each max() is evaluated individually... nice to learn something at the end of the week.
Hope this helps...
Ford Fairlane
Rock and Roll Detective
November 8, 2013 at 12:12 am
A good back to basics question. Thanks!
November 8, 2013 at 12:21 am
palotaiarpad (11/8/2013)
A good back to basics question. Thanks!
Indeed, sometimes the basics need to covered. Whilst really technical questions are great, the more commonly used functions are sometimes overlooked....
Developer, DBA, Pre-Sales consultant.
November 8, 2013 at 12:27 am
Ford Fairlane (11/7/2013)
Very good question - got caught out with as well. Should have realized that with out the where clause that each max() is evaluated individually... nice to learn something at the end of the week.
This has very little to do with the absence of a WHERE clause. The aggregate functions are always individually evaluated within the set of rows on which the aggregate operates.
November 8, 2013 at 12:35 am
Rune Bivrin (11/8/2013)
Ford Fairlane (11/7/2013)
Very good question - got caught out with as well. Should have realized that with out the where clause that each max() is evaluated individually... nice to learn something at the end of the week.This has very little to do with the absence of a WHERE clause. The aggregate functions are always individually evaluated within the set of rows on which the aggregate operates.
You're right, it's more to do with an assumption that the MAX function "acts" like a WHERE clause, which is why people got the answer wrong.
Developer, DBA, Pre-Sales consultant.
November 8, 2013 at 1:05 am
This was removed by the editor as SPAM
November 8, 2013 at 1:06 am
I couldn't believe!
I never expected this kind of question!
It is the same as:
any number multiplied by 0 returns ZERO,
so, you assume that any number added to zero should return ZERO!
:w00t:
November 8, 2013 at 1:17 am
Good question!
I found it easy even before my coffee :-), and I guess everybody have run this anytime
SELECT MIN(ID), MAX(ID) FROM TABLE
which is pretty the same.
November 8, 2013 at 1:28 am
Easy question for end the week...
November 8, 2013 at 2:09 am
I'm sorry, but what?
I'm missing the point of this question. Why would anyone think it could be one of the other answers?
November 8, 2013 at 2:14 am
waxingsatirical (11/8/2013)
I'm sorry, but what?I'm missing the point of this question. Why would anyone think it could be one of the other answers?
I suggest you read some of the posts prior to yours. This may help you in your quandary 🙂
November 8, 2013 at 2:45 am
I kind of agree with waxingsatirical...it never occurred to me anyone would think this works otherwise, and I spent a good few minutes trying to figure out what unexpected behaviour of MAX() the question could be asking for! Eventually I just gave up and answered what I thought would happen, just to see what the answer was, and was somewhat surprised when that turned out to be correct. Guess I'm too used to QotDs looking for knowledge of odd bugs or weird behaviour!
November 8, 2013 at 4:33 am
Good question to end the week. Not everyone knows the basics, so a simple one every once it a while isn't a bad thing.
November 8, 2013 at 4:44 am
paul.knibbs (11/8/2013)
I kind of agree with waxingsatirical...it never occurred to me anyone would think this works otherwise, and I spent a good few minutes trying to figure out what unexpected behaviour of MAX() the question could be asking for! Eventually I just gave up and answered what I thought would happen, just to see what the answer was, and was somewhat surprised when that turned out to be correct. Guess I'm too used to QotDs looking for knowledge of odd bugs or weird behaviour!
Well, as of now 97 people (29%) have answered incorrectly. So there you go...
---------------
Mel. 😎
Viewing 15 posts - 1 through 15 (of 43 total)
You must be logged in to reply to this topic. Login to reply