当前位置:网站首页>GBase 8s V8.8 SQL 指南:教程-6.1.1(4)
GBase 8s V8.8 SQL 指南:教程-6.1.1(4)
2022-04-22 05:24:00 【GBASE数据库】
以下查询返回与图 6所示相同的行。
图: 查询
SELECT order_num, COUNT(*) number, SUM (total_price) price
FROM items
GROUP BY 1
ORDER BY 3;
构建查询时,Projection 子句的投影列表中的所有非聚集列还必须包含在 GROUP BY 子句
中。具有 GROUP BY 子句的 SELECT 语句必须针对每一组返回一行。列出在 GROUP BY
后面的列能够在一组中只反映一个特异值。并且可以返回该值。但是,未列出在 GROUP BY
后面的列可在包含在组中的行中包含不同的值。
下列查询显示如何在连接表的 SELECT 语句中使用 GROUP BY 子句。
图: 查询
SELECT o.order_num, SUM (i.total_price)
FROM orders o, items i
WHERE o.order_date > '01/01/98'
AND o.customer_num = 110
AND o.order_num = i.order_num
GROUP BY o.order_num;
该查询连接 orders 和 items 表,将表别名指定给它们,并返回以下所示的行。
图: 查询结果
order_num (sum)
1008 $940.00
1015 $450.00
版权声明
本文为[GBASE数据库]所创,转载请带上原文链接,感谢
https://blog.csdn.net/weixin_47390342/article/details/124326655
边栏推荐
猜你喜欢

Studio3t expired activation method / and scripts that reset the use date are not available solution / Studio 3T unlimited activation

MySQL数据库第十一次

Domain name encryption is not enough: privacy leakage via IP based website fingerprinting

MySQL数据库第十一次作业-视图的应用

Empty object mode (3.14-3.20)

AssetBundle packaging based on unitygameframework framework

Unity中的UGUI源码解析之事件系统(9)-输入模块(下)

Apache poi HSSF operation Excel

数据库(二)MySQL表的增删改查(基础)

IT配电及防火限流式保护器应用及选型
随机推荐
2022-1-17 to 2022-1-30 iterator mode
Apache poi HSSF operation Excel
Pytorch builds a two-way LSTM to realize time series forecasting (load forecasting)
数据库(二)MySQL表的增删改查(基础)
JSON class of Delphi: superobject, and simple usage jsonhelper
Send a shutdown command to the LAN computer every 30 seconds
Measuring the global recursive DNS infrastructure: a view from the edge
SQL learning record
Idea 2021.1 Useful settings
Unable to resolve dependency for ': app@debug /compileClasspath': Could not download mapsforge-map. jar
IO流..
Reduce the graduation time to before the age of 20, and go to primary school for five years at the age of 5, so as to increase the population
Keil-C51 与 Keil -ARM 共存的方法
時間複雜度和空間複雜度
Unity built-in terrain optimization
Security challenges in an increasingly tangled web
Command mode (3.21-3.27)
Aiming position of unity shooting game
[candelastudio edit CDD] - 2.3 - realize the jump between multiple securitylevels of $27 service (UDS diagnosis)
Remote wake-up server