From the course: Querying Microsoft SQL Server 2022

Unlock the full course today

Join today to access over 24,200 courses taught by industry experts.

Understand NULL values

Understand NULL values

- {Speaker} Null values in a table represent data that's not available or unknown. Since Null literally means nothing, you can't use the same comparison operators to filter records in a select statements WHERE clause like you would when comparing numbers or text strings. It just does not make any sense to ask for records where a Null is equal to something or not equal or greater than some other value. That's why SQL Server gives us two alternate ways to work with records that contain Null values. Let's take a look by creating a query that retrieves data from the WorkOrder table. We'll ask for the WorkOrderID, ScrappedQty, and ScrapReasonID columns from production.WorkOrder. This pulls information of over 72,000 individual work orders. We can see in the results that many of these work orders were completed without any issues. They didn't have any items that needed to be scrapped so the corresponding ScrapReasonID code is Null…

Contents