Skip to content

Instantly share code, notes, and snippets.

@kaichen
Last active August 29, 2015 14:00
Show Gist options
  • Select an option

  • Save kaichen/11280740 to your computer and use it in GitHub Desktop.

Select an option

Save kaichen/11280740 to your computer and use it in GitHub Desktop.
你好MySQL,再见MySQL
SELECT 'normal' = 0 #=> 1
SELECT 'disable' = 0 #=> 1
SELECT 'disable1' = 0 #=> 1
SELECT '1disable' = 0 #=> 0
SELECT '123456' = 0 #=> 0
@ashchan
Copy link
Copy Markdown

ashchan commented Apr 25, 2014

SELECT '1' + 1 # => 2

Apparently string is converted to number even if it's on the left side.

If both arguments in a comparison operation are strings, they are compared as strings...In all other cases, the arguments are compared as floating-point (real) numbers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment