When GROUP BY runs on a column containing NULLs, how are those rows treated?
Correct answer
C. All NULLs form a single group, because GROUP BY treats them as equal to each other
14 views
C. All NULLs form a single group, because GROUP BY treats them as equal to each other
14 views
Grouping and NULL: GROUP BY uses a grouping notion of equality in which NULLs count as equal, so any number of NULL rows collapse into one group. This deliberately differs from the = operator, where NULL = NULL is UNKNOWN. Placement of NULLs by ORDER BY is a separate, dialect-specific matter, with PostgreSQL sorting them last in ascending order.
Asked in: NTS, PPSC IT, Interviews
Not sure why the answer is C? Ask here and get an explanation.