I have a query that looks like this:
`SELECT id, username FROM table_name WHERE username=0`
When I run this query, MySQL returns all rows in table_name. Also, if I replace 0 with false, I get the same results. If I use null or empty string, I do not get returned strings (as expected).
The username column is varchar (50), if that matters.
Then my question is ::
Why is adding 0 or false to this query returns all the rows in the table? Is this a MySQL setup?
This bothers me a bit, since I worked on the assumption that the above request will not return rows (in this particular case), and I am wondering if this happens elsewhere in my application and what unforeseen consequences it may have.
source share