SELECT COUNT(DISTINCT someField) FROM someTable; SELECT DISTINCT someField FROM someTable;
T/F: The value returned by the first will always equal the number of rows returned by the second.
Answer: False. COUNT() doesn’t count NULL, but SELECT DISTINCT will return a NULL. So the query using COUNT() could return one less row than the number of rows found with DISTINCT.

Leave a Reply