Check for null and empty set.
Corrected SQL convention.