CodingDatabases Missing data or the absence of a value in a particular row of a column is represented by NULL. In some sense, NULL values are placeholders to represent the uncertainty of real-world data. When sorting NULL is assumed to be the lowest possible value. A generic query to filter based on whether rows are NULL or not would be as follows

SELECT * FROM table
WHERE column IS [NOT] NULL;

In order to filter columns with possibly missing values, one can use the COALESCE or IFNULL functions. COALESCE takes in a set of column name and a return value to “impute” in the case that that the values of the row for all columns are NULL, otherwise it imputes with the first non-NULL value.

SELECT COALESCE (column1, ..., columnN, val) from table;

On the contrary IFNULL only takes in a single column and single return value:

SELECT IFNULL(column, val) from table;