From the course: Program Databases with Transact-SQL

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Understand NULL values

Understand NULL values - SQL Server Tutorial

From the course: Program Databases with Transact-SQL

Start my 1-month free trial

Understand NULL values

- [Instructor] It's common to misunderstand a null value as meaning zero or nothing. But that isn't the case. Null values have special meaning to SQL server. They represent values that are unknown, missing, or not knowable. This difference has a big impact when you start trying to compare columns that contain nulls. For instance, when creating joints between two tables, if the columns and the join clause of a select statement include null values, then you might not actually see all of the rows and the results that you intended to see. To illustrate how SQL server treats null values, I've set up another pair of variables called variable A and variable B. Both of these are set to the int data type. We can set their values on lines eight and nine, and then test the two variables for equality using a case statement. If variable A is equal to variable B, then the results will say equal. And if the two variables are not equal, then the results will say not equal. So right now I have the two…

Contents