

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
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 significance of using multiple columns in MySQL GROUP BY clause?
By specifying multiple columns in GROUP BY clause we can split the result set into smaller groups. The more columns specified in GROUP BY clause, the smaller the groups will be.
Example
mysql> Select designation, YEAR(Doj), count(*) from employees GROUP BY designation, YEAR(DoJ); +-------------+-----------+----------+ | designation | YEAR(Doj) | count(*) | +-------------+-----------+----------+ | Asso.Prof | 2013 | 1 | | Asst.Prof | 2015 | 1 | | Asst.Prof | 2016 | 1 | | Prof | 2009 | 2 | | Prof | 2010 | 1 | +-------------+-----------+----------+ 5 rows in set (0.00 sec)
- Related Questions & Answers
- Can we use MySQL GROUP BY clause with multiple columns like MySQL DISTINCT clause is used?
- What is the benefit of using MySQL SUM() function with GROUP BY clause?
- MySQL query to GROUP BY multiple columns
- Using GROUP BY and MAX on multiple columns in MySQL?
- What is the use of ORDER BY clause in MySQL?
- How Can MySQL GROUP BY clause behave like DISTINCT clause?
- MySQL filtering by multiple columns?
- What is an Acceleration Clause and what is its significance?
- How to use MySQL DISTINCT clause on multiple columns?
- GROUP BY the number of rows returned by GROUP BY in MySQL?
- Insert multiple data using SET clause in MySQL?
- How to order or choose rows in MySQL GROUP BY clause?
- In a Multiple-line query, what is the significance of the change of MySQL prompt after the first line?
- Limit the count using GROUP BY in MySQL
- How can we create a MySQL view with GROUP BY clause?
Advertisements