课程: SQL Server Fundamentals: Master Basic Query Techniques
今天就学习课程吧!
今天就开通帐号,24,700 门业界名师课程任您挑!
Aggregates
- [Instructor] Doing calculations across multiple rows to find a sum or an average can be a common operation in data analysis and SQL Server provides aggregate functions to do these computations. To do this, we simply have to write a query that indicates how we want to collapse in group rows to do our analysis. For example, in this small sample set, if we want to count the number of rows per item, we could group our query by the item column. We collapse the groups based on unique values in the designated column. So, let's see a few of these aggregate queries in action. So first, if we want to count all of the rows in a table, we would add count star to this query and it would count the number of rows. We didn't provide a grouping condition, so we are basically asking SQL Server to collapse all of the rows in the table to get a count. But if we wanted to count the number of orders per customer, we would group by a…
随堂练习,边学边练
下载课堂讲义。学练结合,紧跟进度,轻松巩固知识。