I got this piece of code from Mysql 4th edition to check table existence
SELECT * FROM table WHERE FALSE;
I cant quite under stand the where clause.
If im not mistaken there is no boolean type in mysql, so basically it been cast to
SELECT * FROM table WHERE 0;
And should it be a column on a where clause?
SELECT * FROM table WHERE column = false;
Any explaination greatly appreciated.
No it doesn’t have to have column as operand 🙂
When you open mysql select manual than expressions you would find there
simple_exprwhat should mean conditions likeWHERE 1(about booleans) but I understand it can be confusing (and it’s rare to use conditions without columns).When you do
SELECT * FROM table WHERE FALSE;it’s basically this:Just take a look on return values from
mysql_query.