List:General Discussion« Previous MessageNext Message »
From:Reinhardt Christiansen Date:August 24 2007 5:16am
Subject:Re: where column
View as plain text  
----- Original Message ----- 
From: "Olav Mørkrid" <olav.morkrid@stripped>
To: <mysql@stripped>
Sent: Friday, August 24, 2007 1:07 AM
Subject: where column


> hello
>
> does anyone know what is returned when you do a where column without
> further parameters?
>
> SELECT * FROM TABLE WHERE COLUMN;
>
> for integer columns it seems to return non-zero columns, but for other
> types of columns the results seemed unpredictable.
>
In my opinion, the statement should not execute at all since it isn't 
syntactically correct. In the dialects of SQL I have used - and I've been 
using SQL for a lot of years - simply saying "WHERE hiredate" (or whatever 
column name you want) is an incomplete statement since the column name must 
be followed by some kind of operator, such as =, <, >, LIKE, or whatever.

Despite that, I am not up-to-date on MySQL and they may support an extension 
that lets you write SQL like that; in that case, the MySQL manual for your 
version should make it clear what happens if you write that.

But I still think it should not execute at all. The WHERE clause is a filter 
to prevent rows that don't satisfy the condition from appearing in your 
result set; "WHERE columnname" is not a complete condition in my opinion so 
it simply should execute.

--
Rhino

Thread
where columnOlav Mørkrid24 Aug
  • Re: where columnReinhardt Christiansen24 Aug
  • Re: where columnShawn Green27 Aug