HOW TO USE GROUP BY CLAUSE IN SQL?

540 viewsSQLSQL
0

HOW TO USE GROUP BY CLAUSE IN SQL?

Saraswat World Changed status to publish June 8, 2023
0
GROUP BY in SQL
GROUP BY in SQL

GROUP BYย clause in SQL statements is used to group the result-set by one or more columns that have the same values. It is often used with aggregate functions like SUM, AVG, MIN, MAX & COUNT. GROUP BY clause is placed after WHERE clause.

Syntax of GROUP BY clause in SQL-

SELECTย <column_name(s)>

FROMย <table_name>

WHERE<condition>

GROUP BY<column_name(s)>;

Example of GROUP BY clause in SQL-

SELECT COUNTย (CustomerID), Country

FROMย Customers

GROUP BYย Country;

โ€“This SQL statement will list the number of customers in each country.

Saraswat World Changed status to publish June 8, 2023
You are viewing 1 out of 1 answers, click here to view all answers.
Write your answer.

Posted

in

Tags:

Comments

Leave a Reply

A Tribute to Dilip Kumar