Preserved Topic: NULL MySQL values. |
|
---|---|
Author | Thread |
Paranoid (IV) Inmate From: Minneapolis, MN, USA |
posted 05-31-2001 21:14
I seem to recall in a past message someone making an offhanded comment about how using NULL values in a MySQL table is questionable practice. I think I understand why now. It would seem you can not use null in a where clause, err, you can, but it doesn't match with null values. |
Paranoid (IV) Inmate From: New Jersey, USA |
posted 05-31-2001 22:27
You can use null in a where clause, but not with regular operators (i.e., =, !=) you must use IS NULL or IS NOT NULL when trying to match null values in tables. |
Paranoid (IV) Inmate From: other places |
posted 05-31-2001 22:38 |
Paranoid (IV) Inmate From: Minneapolis, MN, USA |
posted 05-31-2001 22:49
Hm, thanks, sadly that adds a lot of complexity to my PHP scripts since any one of 20 fields could be null. Luckily the empty string solution seems to work great as long as I reserve the integer 0 only for 'empty' fields. |
Paranoid (IV) Inmate From: New Jersey, USA |
posted 06-01-2001 00:22
Because NULL does not have a definable value. The only way to describe null, is that it has no value, which is why you can't use mathematical operators to test for null, you can't compare something that has no legal value. |
Paranoid (IV) Inmate From: Madison, Indiana, USA |
posted 06-01-2001 17:50
I have used test for "Is NULL" and "Is Not NULL" on MySQL, Sybase, and Access. I don't know if it's ANSII standard, but a lot of databases seem to use it. |