Duration: 16:35 min
Summary: In this video, we will discuss the use of the ‘if statement’. SQL supports the use of the ‘if statement’ like other programming languages do. We start with an expression that needs to be evaluated. If that expression evaluates to true, the statements in the begin/end block after the’ if’ are executed. Otherwise, the statements in the begin/end block after the else are executed. Notice that we are using the ‘print’ statements to write text. I use that often while testing some SQL code and printing content out. After the ‘if statement’, we will talk about using ‘null’. We know that some data is not available. It is not 0 or empty string. It is simply not provided. SQL treats that as ‘null’. It is important that your account for null values while writing your SQL code. We will see how to use ‘IsNull’ to test for null values.