The “GROUP BY” clause groups records into summary rows and returns one records for each group. It is also involves aggregates like COUNT, MAX, SUM, AVG and so on…
The “GROUP BY” can be group by the single or multiple columns.
SELECT ColumnNames FROM TableName WHERE Condition GROUP BY columnNames
Example:-
SELECT DISTINCT CountryName, CountryCode FROM Countries GROUP BY CountryName, CountryCode
Result:-
CountryName CountryCode --------------------------- India IN Nepal NP Rasia RA USA US
I hope you are enjoying
with this post! Please share with you friends. Thank you!!