In MySQL: x^y != x raised to the y
November 18, 2008
As the title states, the caret (^) is not used as an exponent in MySQL. I’m not certain what exactly it does (and couldn’t find any documentation after a quick search), and would love to find out what its purpose is. I ran into this problem today when I noticed that MySQL’s math results (using ^) didn’t match my own. After triple checking my own math, I added lots of parens and still got nowhere, so I checked the Operator Precedence and sure enough it listed the caret (^) as falling between “*, /, DIV, %, MOD” and “- (unary minus), ~ (unary bit inversion)".