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 - SQL Server Tutorial
From the course: Querying Microsoft SQL Server 2022
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
Limit results with TOP4m 39s
-
(Locked)
Remove duplicates with DISTINCT2m 53s
-
(Locked)
Comparison operators3m 43s
-
(Locked)
Understand NULL values4m 42s
-
(Locked)
Match text with LIKE and wildcards4m 36s
-
(Locked)
Challenge: Retrieve matching text strings49s
-
(Locked)
Solution: Retrieve matching text strings4m 52s
-
(Locked)
Solution: Filter results from a query result4m 28s
-
-
-
-
-
-
-
-
-