mysql: mysterious sideways single quote and IS NOT NULL -


i have 2 queries can run , 2 totally different results, solely because use "sideways single quote" versus single quote. see below:

select * items 'natural' not null 

will return every record regardless if "natural" column set null

select * items `natural` not null 

will correctly return records there values set column "natural"

that ain't right.

your first example 'natural' not null tests see if string literal 'natural' not null. since string literals not null, condition true.

the second example tests value of column name natural. want.

related

string literals

a string sequence of bytes or characters, enclosed within either single quote (') or double quote (") characters.

schema object names

the identifier quote character backtick ( ` )


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -