首页 > 其他分享 >ROLLUP, CUBE, GROUPING Functions and GROUPING SETS

ROLLUP, CUBE, GROUPING Functions and GROUPING SETS

时间:2025-01-21 19:56:51浏览次数:3  
标签:Functions sales value SETS id fact GROUPING

ORACLE-BASE - ROLLUP, CUBE, GROUPING Functions and GROUPING SETS

看不懂的可以来问

-------------------------------------------------------------------------------------------------------------------------------

完了,我也看不懂了

思考一下几个SQL 的result sets:
 

SELECT fact_1_id,
       fact_2_id,
       fact_3_id,
       SUM(sales_value) AS sales_value,
       GROUPING_ID(fact_1_id, fact_2_id, fact_3_id) AS grouping_id
FROM   dimension_tab
GROUP BY GROUPING SETS((fact_1_id, fact_2_id), (fact_1_id, fact_3_id),())
ORDER BY fact_1_id, fact_2_id, fact_3_id;


SELECT fact_1_id,
       fact_2_id,
       SUM(sales_value) AS sales_value,
       GROUPING_ID(fact_1_id, fact_2_id) AS grouping_id
FROM   dimension_tab
GROUP BY rollup((fact_1_id,fact_2_id),fact_1_id)
ORDER BY fact_1_id, fact_2_id;


SELECT fact_1_id,
       fact_2_id,
       SUM(sales_value) AS sales_value,
       GROUPING_ID(fact_1_id, fact_2_id) AS grouping_id
FROM   dimension_tab
GROUP BY GROUPING SETS((fact_1_id, fact_2_id)),rollup(fact_1_id)
ORDER BY fact_1_id, fact_2_id;

标签:Functions,sales,value,SETS,id,fact,GROUPING
From: https://blog.csdn.net/weixin_44875522/article/details/145265905

相关文章

  • Flutter跨插件访问assets资源
    1.现在常常以插件话和组件化开发移动端,我们在使用原生访问flutter的Assets资源时常常可以这样写valflutterAssetStream=assetManager.open("flutter_assets/assets/my_flutter_asset.png")但是如果是跨插件的话可能就不行了,比如一个主项目可能引入了好几个问呢-----》使用......
  • Activation Functions
    Chapter4:ActivationFunctions声明:本篇博客笔记来源于《NeuralNetworksfromscratchinPython》,作者的youtube其实关于神经网络的入门博主已经写过几篇了,这里就不再赘述,附上链接。1.一文窥见神经网络2.神经网络入门(上)3.神经网络入门(下)前三章内容:1.CodingOu......
  • wx.batchSetStorage
    wx.batchSetStorage(Objectobject)基础库2.25.0开始支持,低版本需做兼容处理。以Promise风格调用:支持小程序插件:不支持微信鸿蒙OS版:支持相关文档:存储策略功能描述将数据批量存储在本地缓存中指定的key中。会覆盖掉原来该key对应的内容。除非用户主动删......
  • CSS系列(46)-- Color Functions详解
    前端技术探索系列:CSSColorFunctions详解......
  • 【Basic Abstract Algebra】Exercises for Section 3.1 — Cosets and Lagrange's The
    Let\(G\)beafinitegroupand\(H<G\).If\([G:H]=2\),then\(gH=Hg\).Proof:If\([G:H]=2\),thenthereareonlytwocosetsof\(H\)in\(G\),andoneofthecosetsis\(H\)itself,i.e.,\[G=H\cupgH=H\cupHg,\]where\(H\cap......
  • WPF call graphic draw functions via bitmap converting to bitmapimage
    usingSystem;usingSystem.Collections.Generic;usingSystem.Drawing;usingSystem.IO;usingSystem.Linq;usingSystem.Text;usingSystem.Threading.Tasks;usingSystem.Windows;usingSystem.Windows.Controls;usingSystem.Windows.Data;usingSystem.Windows......
  • 海山数据库(He3DB)源码解读:T_DropRoleSetStmt原理浅析
    一、概述  DropRoleStmt表示删除角色的DDL语句。。二、DropRole命令的执行流程PostgresMainexec_simple_query→执行简单的SQL查询;StartTransactionCommand→开始事务;pg_parse_query→解析为内部的抽象语法树(AST);PortalRunstandard_ProcessUtility→权限......
  • QT使用promoted后样式(setStyleSheet)不生效
    1.理解promoted(提升)在Qt中的概念在QtDesigner中,“提升(Promoted)”是一种机制,它允许你使用自定义的部件类来替代标准的Qt部件类。这在你已经创建了一个从标准Qt部件(如QListWidget)派生的自定义部件(如ListMenu)并且希望在设计器环境中使用它时非常有用。2.样式不生效的......
  • Towards Robust Evaluation: A Comprehensive Taxonomy of Datasets and Metrics for
    本文是LLM系列文章,针对《TowardsRobustEvaluation:AComprehensiveTaxonomyofDatasetsandMetricsforOpenDomainQuestionAnsweringintheEraofLargeLanguageModels》的翻译。迈向稳健评估:大语言模型时代开放领域问答的数据集和指标的综合分类摘要1......
  • 论文阅读:Statistical Comparisons of Classifiers over Multiple Data Sets
    论文地址:StatisticalComparisonsofClassifiersoverMultipleDataSets(acm.org)前面在机器学习之Friedman检验-CSDN博客中提到了Friedman检验,这里将对这个方法的论文进行详细的阅读,以了解其原理。摘要尽管用于在单个数据集上比较两种学习算法的方法已经研究了相当......