SQL GROUP BY 子句如何管理 NULL 值?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/22802078/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How does the GROUP BY clause manage the NULL values?
提问by Nizam Uddin Sikder
How does the GROUP BY clause manage the NULL values? Does it correspond to the general treatment of these values?
GROUP BY 子句如何管理 NULL 值?它是否符合对这些值的一般处理?
回答by Mudassir Hasan
Null values of a column are grouped as a separate group.
列的空值被分组为一个单独的组。
See SQL Fiddledemonstrating Group By and aggregate functions on nullable column
请参阅SQL Fiddle演示可空列上的 Group By 和聚合函数
回答by Euro Micelli
You mean, when you GROUP BY
a nullable column? All rows with a NULL in the column are treated as if NULL was another value.
你的意思是,当你GROUP BY
是一个可以为空的列时?列中具有 NULL 的所有行都被视为 NULL 是另一个值。
If a grouping column contains null values, all null values are considered equal, and they are put into a single group.
如果分组列包含空值,则所有空值都被视为相等,并将它们放入一个组中。
回答by yugesh
Group By groups all the records with NULL values.
Group By 将所有具有 NULL 值的记录分组。