In my table table1 there are 6 columns Locations,a,b,c,d,e.
Locations [a] [b] [c] [d] [e]
 10.00 Null Null 20.00 Null
 Null 30.00 Null Null Null
Locations [a] [b] [d]
 10.00 Null 20.00
 Null 30.00 Null
How to detect whether a given column has only the
SELECT 1 -- no GROUP BY therefore use a literal FROM Locations HAVING COUNT(a) = 0 AND COUNT(*) > 0;
The resultset will either consist of zero rows (column
a has a non-
NULL value) or one row (column
a has only the
NULL value). FWIW this code is Standard SQL-92.