Which SQL clause is used to arrange rows into groups based on one or more columns?
Options
-
A.
ORDER BY
-
B.
GROUP BY
-
C.
HAVING
-
D.
More than one of the above
-
E.
None of the above
Correct Answer (Detailed Explanation is Below)
B.
GROUP BY
Detailed Explanation
- GROUP BY: Groups rows that have the same values in specified columns.
- It is commonly used with aggregate functions.
- Example: SELECT department_id, COUNT(*) FROM employees GROUP BY department_id;
OOps! You are currently offline.