I've found something in MySQL which astonished me a lot. I created a table and inserted records into it as below,
CREATE TABLE `test` (
`ID` int,
`NAME` varchar(100)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO test VALUES (1,'a'),(2,'b'),(3,'c');
Now, I run two SELECT queries against this as below,
select * from test where id;
select * from test where name;
I noticed these queries do not throw syntax errors but the "first" select query returns result as
select * from test;
while the "second" one doesn't return any. This means if the where clause contains an "integer" column I get a result set, while I don't get any if where clause contains a "varchar" column.
Can anyone tell me whether this is a bug or a feature in MySQL? Also explain me why this happens.
Thanks in advance!