Sorry in advance - this seems like a really dumb question. But...
If I run a select query on a varchar() column, but use zero for the column value in the where clause - why does it return all rows?
For example:
CREATE TABLE test (
id INT,
person varchar(50)
);
INSERT INTO test (id, person) VALUES (1, "Alice");
INSERT INTO test (id, person) VALUES (2, "Bob");
SELECT * FROM test where person = 0;
I would expect this to either return an error, or an empty result set. Instead, it returns all rows?!?!
Why is that?