13.7 NULL Values
In SQL, NULL is a special marker that is often used to indicate the absence of a data value in the database. It is important to note that NULL is different from an empty string or a zero, which are actual values. When a value is set to NULL, it means that the value is currently unknown, missing, or not applicable.
In the context of our bookshop database, NULL could be used to represent the price of a book that we currently do not know. For instance, we might receive a new book that has not yet been priced, or we may be waiting for the publisher to provide us with the information. In such cases, the 'Price' column for this book would be set to NULL. This allows us to keep track of the book in the database, while also indicating that the price information is not yet available.
It is important to handle NULL values properly when writing SQL queries. For example, if we want to retrieve all books that cost less than $20, we need to be careful not to exclude books...