MySQL Testing NULLs


Example

  • IS NULL / IS NOT NULL -- = NULL does not work like you expect.
  • x <=> y is a "null-safe" comparison.

In a LEFT JOIN tests for rows of a for which there is not a corresponding row in b.

SELECT ...
    FROM a
    LEFT JOIN b ON ...
    WHERE b.id IS NULL