
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is the use of WITH ROLLUP modifier in MySQL?
“WITH ROLLUP” is a modifier that is used with GROUP BY clause. Mainly, it causes the summary output to include extra rows that represent higher-level summary operations.
Example
In the example below, WITH ROLLUP modifier gave the summary output with total price value in the extra row.
mysql> Select Item, SUM(Price) AS Price from ratelist Group by item WITH ROLLUP; +------+-------+ | Item | Price | +------+-------+ | A | 502 | | B | 630 | | C | 1005 | | h | 850 | | T | 250 | | NULL | 3237 | +------+-------+ 6 rows in set (0.00 sec)
Advertisements