MYSQL Syntax for NOT in where clause - 08-08-2005 , 02:10 PM
I am confused with the syntax for NOT in MYSQL where clause and wonder
if an expert in MYSQL can enlighten me. There are possibly two places
NOT can go in:
select * from employee_data where NOT employee_id LIKE 'A%'
select * from employee_data where employee_id NOT LIKE 'A%'
In the first case, there was no data returned and no error message on
syntax either. But the second case returned the correct result. But I
am confused because if the first case is not right, the syntax error
should be thrown. Am I missing something?
Thank you in advance,
Re: MYSQL Syntax for NOT in where clause - 08-08-2005 , 03:32 PM
sunny076 (AT) yahoo (DOT) com wrote:
That's an operator (i.e. logical not is applied to "employee_id" before
being compared to LIKE 'A%'), see
MySQL AB, Software Development Manager - Connectivity
Re: MYSQL Syntax for NOT in where clause - 08-13-2005 , 12:30 PM
MySQL is, once again, not up to Standards.
SELECT * FROM Personnel WHERE NOT employee_id LIKE 'A%'
should have been parsed as
SELECT * FROM Personnel WHERE NOT (employee_id LIKE 'A%' )
which is how this is defined :
SELECT * FROM Personnel WHERE employee_id NOT LIKE 'A%'
Just keep telling yourself that you can replace this toy file system
with Ingres, Postgres, Firebird or some other open source database.