TAILIEUCHUNG - Enhancements to the GROUP BY Clause

After completing this lesson, you should be able to do the following: Use the ROLLUP operation to produce subtotal values Use the CUBE operation to produce cross-tabulation values Use the GROUPING function to identify the row values created by ROLLUP or CUBE Use GROUPING SETS to produce a single result set | Enhancements to the GROUP BY Clause Schedule: Timing Topic 45 minutes Lecture 30 minutes Practice 75 minutes Total Objectives After completing this lesson, you should be able to do the following: Use the ROLLUP operation to produce subtotal values Use the CUBE operation to produce cross-tabulation values Use the GROUPING function to identify the row values created by ROLLUP or CUBE Use GROUPING SETS to produce a single result set Lesson Aim In this lesson you learn how to: Group data for obtaining the following: Subtotal values by using the ROLLUP operator Cross-tabulation values by using the CUBE operator Use the GROUPING function to identify the level of aggregation in the results set produced by a ROLLUP or CUBE operator. Use GROUPING SETS to produce a single result set that is equivalent to a UNION ALL approach. Review of Group Functions Group functions operate on sets of rows to give one result per group. SELECT [column,] group_function(column). . . FROM table [WHERE condition] [GROUP BY group_by_expression] [ORDER BY column]; SELECT AVG(salary), STDDEV(salary), COUNT(commission_pct),MAX(hire_date) FROM employees WHERE job_id LIKE 'SA%'; Example: Group Functions You can use the GROUP BY clause to divide the rows in a table into groups. You can then use the group functions to return summary information for each group. Group functions can appear in select lists and in ORDER BY and HAVING clauses. The Oracle Server applies the group functions to each group of rows and returns a single result row for each group. Types of Group Functions Each of the group functions AVG, SUM, MAX, MIN, COUNT, STDDEV, and VARIANCE accept one argument. The functions AVG, SUM, STDDEV, and VARIANCE operate only on numeric values. MAX and MIN can operate on numeric, character, or date data values. COUNT returns the number of nonnull rows for the given expression. The example in the slide calculates the average salary, standard deviation on the salary, number of employees earning a .

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.