当前位置:   article > 正文

详解GROUPING函数

grouping函数

官方文档地址:http://docs.oracle.com/cd/B19306_01/server.102/b14200/functions062.htm#SQLRF00647

 

 

GROUPING

Syntax

Description of grouping.gif follows
Description of the illustrationgrouping.gif

Purpose

 

GROUPING distinguishes superaggregate rowsfrom regular grouped rows.GROUP BYextensions such as ROLLUP and CUBEproduce superaggregate rows where the set of all values isrepresented by null.

--GROUPING函数可以从常规分组行中区分超聚集行。GROUPBY的扩展比如ROLLUP andCUBE会生成

出现空值的一系列值集合的超聚集行。

 

Using the GROUPING function, you candistinguish a null representing the set of all values in asuperaggregate row from a null in a regular row.

--使用GROUPING函数,你能够区分代表着在一个超聚集行中一系列值集合的空值和常规行中的空值。

 

即是:使用GROUPING函数,你能够区分这个空值(NULL值),是由一个超聚集行的表达式所产生空值(thevalue ofexpr in therow,表达式指的是GROUPING函数中的表达式(expr)),还是这个表达式的原来在数据库中存储的值就是空值 (NULL值)。自己可实验。如下,

表:ship_cabins。

Select * Fromship_cabins。查询的第二行数据的列ROOM_TYPE值为空值(即数据库存储的值为空值)

ship_cabin_id    room_style       room_type      sq_ft

               Suite            Standard       533
               Stateroom                        160
           

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/知新_RL/article/detail/345162?site
推荐阅读
相关标签
  

闽ICP备14008679号