I have a tickets table where assigned_to is NULL for unassigned tickets. WHERE assigned_to = NULL returns nothing, and WHERE assigned_to <> 5 leaves out the unassigned tickets even though NULL is clearly not 5. Worse, WHERE id NOT IN (SELECT parent_id FROM tickets) returns zero rows although I can see tickets that are nobody's parent.
What are the rules for NULL in comparisons, and how should these three queries be written?




