dbTalk Databases Forums  

MYSQL Syntax for NOT in where clause

comp.databases comp.databases


Discuss MYSQL Syntax for NOT in where clause in the comp.databases forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
sunny076@yahoo.com
 
Posts: n/a

Default MYSQL Syntax for NOT in where clause - 08-08-2005 , 02:10 PM






Hi,

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,

Sunny


Reply With Quote
  #2  
Old   
Mark Matthews
 
Posts: n/a

Default Re: MYSQL Syntax for NOT in where clause - 08-08-2005 , 03:32 PM






sunny076 (AT) yahoo (DOT) com wrote:
Quote:
Hi,

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%'
^^^^

Sunny,

That's an operator (i.e. logical not is applied to "employee_id" before
being compared to LIKE 'A%'), see
http://dev.mysql.com/doc/mysql/en/lo...operators.html

-Mark


--
Mark Matthews
MySQL AB, Software Development Manager - Connectivity
www.mysql.com


Reply With Quote
  #3  
Old   
sunny076@yahoo.com
 
Posts: n/a

Default Re: MYSQL Syntax for NOT in where clause - 08-08-2005 , 05:57 PM



Thanks a lot.


Sunny


Reply With Quote
  #4  
Old   
--CELKO--
 
Posts: n/a

Default 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.


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.