Link to home
Start Free TrialLog in
Avatar of Richard Korts
Richard KortsFlag for United States of America

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
ASKER CERTIFIED SOLUTION
Avatar of mankowitz
mankowitz
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
NULL values are a bit special
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