当前位置:网站首页>GBase 8s V8. 8 SQL Guide: tutorial-5.2 (3)

GBase 8s V8. 8 SQL Guide: tutorial-5.2 (3)

2022-04-22 05:26:00 Gbase database

The following query and figure 4 identical , But it includes ORDER BY Clause by price Sort the retrieved rows in ascending order ,
As shown below .
chart : Inquire about
SELECT order_num, COUNT(*) number, SUM (total_price) price
 FROM items
 GROUP BY order_num
 ORDER BY price;
chart : Query results
 order_num number price
 
 1010 2 $84.00
 1011 1 $99.00
 1013 4 $143.80
 1022 3 $232.00
 1001 1 $250.00
 1020 2 $438.00
 1006 5 $448.00
 ⋮
 1002 2 $1200.00
 1004 4 $1416.00
 1014 2 $1440.00
 1019 1 $1499.97
 1021 4 $1614.00
 1007 5 $1696.00
The section select a specific column describes how to select a specific column in ORDER BY Use integers in the clause to indicate the position of columns in the projection list . also
Can be in GROUP BY Clause to indicate the position of the column name or in GROUP BY The list displays the symbol
Number .

版权声明
本文为[Gbase database]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204220524175647.html