I am very much new to SQL and have been given an exercise for homework that sounds when translated like this: "For each column type find the number of tables that do not contain this type of column". I know how to find count of tables that contain at least one column type:
SELECT Data_Type, COUNT(Table_schema || '.' || table_name)
FROM Information_schema.Columns
GROUP BY Data_Type;
But trying to figure out how to do the opposite of this has left me scratching my head for hours. I have tried to use WHERE:
WHERE Data_Type IS NULL
But it gives same results as the query without this line. I have seen solutions when counting tables with specifically named columns (using 'join' and 'not in') but I don't think this would work for this task. I think NOT EXISTS would probably work but not sure how to implement it. Thanks in advance!