Richard Korts
asked on
MySQL - I don't understand
See attached. This is a small sample of a table (named "customer") that I have.
Notice the column called cutype in most cases the value is NULL (in italics), I don't know what that means.
I run this query: DELETE from customer where cutype <> 'i'
It deletes the 79 rows that have blank (not NULL) in the column.
It leaves all the rest.
Actually, at this moment, there are NO rows in the table where cutype = 'i'.
Why does it leave the NULL ones? That is not a value of 'i'.
Thanks
cutype.jpg
Notice the column called cutype in most cases the value is NULL (in italics), I don't know what that means.
I run this query: DELETE from customer where cutype <> 'i'
It deletes the 79 rows that have blank (not NULL) in the column.
It leaves all the rest.
Actually, at this moment, there are NO rows in the table where cutype = 'i'.
Why does it leave the NULL ones? That is not a value of 'i'.
Thanks
cutype.jpg
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
http://dev.mysql.com/doc/refman/5.1/en/working-with-null.html
If you want to delete rows with NULL values you have to declare them
DELETE from customer where cutype <> 'i' OR cutype IS NULL