课程: Intermediate SQL for Data Scientists
今天就学习课程吧!
今天就开通帐号,24,700 门业界名师课程任您挑!
Solution: Segment a data set using window functions - SQL教程
课程: Intermediate SQL for Data Scientists
Solution: Segment a data set using window functions
(upbeat music) - [Instructor] The solution to this challenge is as follows. We write a SELECT statement where we include the department_id, the last_name, and the salary. And then we specify a window function using the sum aggregate, and we're going to sum salary. And then we sum over the partitioning by department_id. And of course, we select this from the data_sci.employees table. And we see over here on the right, the results are as we would expect, where we are seeing the sum over partition along with the information on each employee in the particular department.