The IFNULL function writes out a specified value if the source value is a null. Otherwise, it writes the source value. Input can be a literal, a column reference, or a function.

Output: Returns the value 0 if the value in my_score is a null. 


ArgumentRequired?Data TypeDescription
source_valueYstringName of column, string literal or function to be tested
output_valueystringString literal value to write

source_value

Name of the column, string literal, or function to be tested for null values.

Required?Data TypeExample Value
YesString literal, column reference, or functionmyColumn

output_value

The output value to write if the tested value returns a null value.

Required?Data TypeExample Value
YesString or numeric literal'Null input'

Example - IF* functions for data type validation