2019-09-17, 12:37 AM (ISO 8601)
Firbolg in the Playground
Re: minor programming rant
I suppose that's true....At the same, any aggregate function that works with values would need to return NULL if there's any NULL in the set it's working on, undercutting the general usefulness of aggregate functions without some sort of prefiltering scheme...and it turns out SQL's prefiltering scheme is "filter out NULL values before passing to aggregate functions that aren't COUNT(*) ." Which, incidentally, means you could compare a COUNT with a COUNT(*) to check for the presence (and number) of NULLs, when that's important.
Originally Posted by veti
Is it kind of a hacky way to say "MAX returns the highest known value" and not need special steps for when a value might be (or might ever become) NULL? Yes...but I think I'm okay with erring on the side of maintainability, in this case.