DEPARTMENT_NAMEis always empty when
EMPLOYEE_ID_OF_SUPERVISORis empty and vice versa. This indicates that there might be a common reason.
DEPARTMENT_IDis missing from the departments table. Thus, all the fields that you select from the departments table, i.e.
EMPLOYEE_ID_OF_SUPERVISORwill be empty as well.
GROUP BYusing all indicator columns, you will get a distinct list of all missing value patterns along with the number of observations in each pattern. You can sort them by the number of observations in descending order to get an idea of the most frequent missing value patterns.
Kis the number of columns in the table, you will end up with
Kindicator columns and one count column. Writing the SQL that calculates the missing value patterns will become tedious if the number of columns
Kis large. Of course, you can use SQL to generate the SQL from the table metadata, using for example the table
DBC.COLUMNSVin Teradata that contains a list of columns of each table in the database.
Kcharacters. That way, the intermediate result is typically smaller and you only need to group by a single column.