Advertisements
Advertisements
प्रश्न
What is the purpose of the following clause in a select statement?
GROUP BY
टीपा लिहा
Advertisements
उत्तर
The GROUP BY clause is used in the SELECT statement, to divide the table into groups i.e combines all records that have identical values in a particular field.
Grouping can be done by a common column name or with aggregate functions in which case the aggregate produces a value for each.
For example:
mysql> SELECT GENDER, COUNT(*) FROM STUDENT GROUP BY GENDER;
OUTPUT:
GENDER COUNT(*)
MALE 20
FEMALE 15
shaalaa.com
GROUP BY Clause in SQL
या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
पाठ 9: Structured Query Language (SQL) - Exercise [पृष्ठ १७६]
