I have a shop_categories table with a category_is_hidden field that is defined as:
category_is_hidden tinyint(4) DEFAULT NULL
In the database, the values ββfor this field are 1 or NULL.
SELECT * FROM shop_categories where category_is_hidden IS NULL
returns all null entries.
SELECT * FROM shop_categories where category_is_hidden <> 1
returns empty sets (i.e. excludes null values).
Why doesn't the last statement contain null entries? not null <> 1 </p>
Edit: tested on MySQL 5.1 and 5.5
source share