Selecting Null Values

From earlier chapters (“NULLs” in Chapter 1), you may recall that NULL is a placeholder for unknown information. It does not mean zero or blank.

To clarify this NULL–zero difference, take a look at the following listing showing title and advance amount for books belonging to one particular publisher.

SQL
select title, advance
from titles
where pub_id = '0877'
title                                                         advance
============================================================= =======
Silicon Valley Gastronomic Treats                                0.00
Sushi, Anyone?                                                8000.00
Fifty Years in Buckingham Palace Kitchens                     4000.00
The Gourmet Microwave                                        15000.00
Onions, Leeks, and Garlic: Cooking Secrets of the
  Mediterranean                                               7000.00
The Psychology of Computer Cooking                             (NULL)
[6 rows]

A cursory perusal ...

Get Practical SQL Handbook, The: Using SQL Variants, Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.