Question:

Which of the following statement is CORRECT about GROUP BY clause in SQL?

Show Hint

Remember:
- GROUP BY creates distinct subsets of matching data.
- Aggregate functions (COUNT, SUM, AVG) calculate values for each distinct group.
Updated On: Sep 7, 2026
  • The GROUP BY clause is used to sort data in ascending or descending order.
  • GROUP BY allows you to aggregate data, but it cannot be used with aggregate functions like SUM, AVG or COUNT.
  • The GROUP BY clause is used to arrange identical data into groups often used with aggregate functions such as SUM, AVG or COUNT.
  • The GROUP BY clause merges the contents of two or more tables.
Show Solution
collegedunia
Verified By Collegedunia

The Correct Option is C

Solution and Explanation

Concept:
The GROUP BY statement groups rows that have the same values in specified columns into summary rows (e.g., "find the average marks for each department").

Step 1: Evaluating the Role of GROUP BY:

In relational databases, GROUP BY collapses rows with identical attribute values into unique summary buckets.
It is typically paired with aggregate functions like SUM(), AVG(), MIN(), MAX(), and COUNT() to calculate statistical metrics over each group.
Therefore, statement (C) provides the correct definition and intended usage.

Step 2: Evaluating Distractor Statements:

- Statement (A) describes the ORDER BY clause, not GROUP BY.
- Statement (B) claims that it cannot be used with aggregate functions, which contradicts its primary design purpose.
- Statement (D) describes table operations such as JOIN or UNION, which combine data from multiple tables.
Final Answer:
Statement (C) correctly describes the functionality of the GROUP BY clause.
Was this answer helpful?
0
0