I have an interesting result and don’t understand why.
SELECT *
FROM items im
WHERE ItemNumber
ItemNumber is a varchar(50).
The results of this query is returning all items that the ItemNumber starts with a number. If the ItemNumber begins with a letter, it is excluded.
Does anyone have an explanation why the query interacts in this way?
MYSQL will return all rows with the ItemNumber starts with a number which is
greater than equal to 0.5 and less than equal to -0.5. It consider all numbergreater >= +/-0.5 as true. Andwhereclause works based on true or false only.Very smartly, mysql consider All
>= +/-0.5number as 1 (true). It takes true for rounded non-zero values.IF you write