Is it possible to use Aggregate function in a Select statment without using Group By clause?

前端 未结 7 1501
-上瘾入骨i
-上瘾入骨i 2020-12-14 18:04

So far I have written Aggregate function followed by Group By clause to find the values based on SUM, AVG and other Aggregate functions. I have a bit confusion in the Group

7条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-14 18:48

    Yes you can use an aggregate without GROUP BY:

    SELECT SUM(col) FROM tbl;
    

    This will return one row only - the sum of the column "col" for all rows in tbl (excluding nulls).

提交回复
热议问题