Created
March 8, 2012 00:57
-
-
Save slpsys/1997678 to your computer and use it in GitHub Desktop.
Herein I chronicle things that piss me off.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Why do | |
DATE_DIFF('2012-3-1', '2012-3-2') | |
# and | |
DATE_ADD('2012-3-1', INTERVAL 1 DAY) | |
# have different naming conventions? | |
# this returns [0, n] | |
select count(*), datediff(`a`,`b`) from `table` group by datediff(`a`,`b`) | |
# this returns n - k, k > 0 | |
select count(*) from `table` where `a` <> `b` | |
# this returns k, k > 0 | |
select count(*) from `table` where `a` = `b` | |
# why are these being stored differently, why are these operators even available | |
# if they return nonsensical results? | |
# i love how "for best results" is plastered all over the datetime docs. | |
# At least in the .NET driver (all? investigating), variables are bound by order, not by name. Well, for stored procedures. | |
# And only for stored procedures. This means a.) you must always manually add parameters in the correct order, and b.) you | |
# need to specify type information yourself if you're binding NULLs (e.g. anywhere you're passing reference types). But not | |
# if you're binding variables to prepared raw SQL, that's fine with binding untyped nulls, because that's simple string | |
# interpolation. The more I write, the more this sounds like it's the fault of the official .NET driver, but nonetheless, | |
# it's annoying. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment