Web lists-archives.com

Re: find any row with NULL




You will have to repeat all the column names - no wildcards in where clause fieldnames - but the clause you're looking for is WHERE field IS NULL. Or IS NOT NULL if you want those :-)

Remember, NULL is a special value that is not the same as zero or the empty string; nor to itself: NULL != NULL, by definition. Personally, I mostly discourage the use of it (use DEFAULT VALUE in your table definition wherever possible) except in circumstances where it really is necessary to know the difference between 'nothing here' and 'we have no information about this at all'.

As a clear example of what it is useful for, imagine a situation where you're performing an inventory on an existing warehouse. You have the list of all the products they've ever sold, but you need to differentiate between 'this product is not in stock' (count = 0) and 'I have not counted this product yet' (count IS NULL).

/Johan

----- Original Message -----
> From: "lejeczek" <peljasz@xxxxxxxxxxx>
> To: "MySql" <mysql@xxxxxxxxxxxxxxx>
> Sent: Friday, 8 July, 2016 14:27:45
> Subject: find any row with NULL

> hi there,
> 
> I've been searching the vastness of the net but cannot find
> - how - to get all the rows with a NULL.
> 
> And like any novice I wonder if this can be done without
> reiterating all the columns names(not manually at least)?
> 
> Some expert would say it is easy, how easy is it? with an
> example?
> 
> many thanks
> 
> L.
> 
> 
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    http://lists.mysql.com/mysql

-- 
Unhappiness is discouraged and will be corrected with kitten pictures.

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql