EmpID EmpName Dept. Salary Location Rating 201 Smith IT 75000 Chicago 4.5 202 Jane HR 60000 New York 4.7 203 Alice Finance 80000 San Francisco 4.8 204 Bob IT 76000 Denver 4.6 205 Sarah Marketing 68000 Seattle 4.9
Based on the table 'EMPLOYEES' above, what will be the correct sequence of the following statements that will provide the total number of employees in each dept?
(A) SELECT column Dept
(B) GROUP BY Dept
(C) COUNT(*) the total number of employees
(D) FROM the table EMPLOYEES
| EmpID | EmpName | Dept. | Salary | Location | Rating |
|---|---|---|---|---|---|
| 201 | Smith | IT | 75000 | Chicago | 4.5 |
| 202 | Jane | HR | 60000 | New York | 4.7 |
| 203 | Alice | Finance | 80000 | San Francisco | 4.8 |
| 204 | Bob | IT | 76000 | Denver | 4.6 |
| 205 | Sarah | Marketing | 68000 | Seattle | 4.9 |
Based on the table 'EMPLOYEES' above, what will be the correct sequence of the following statements that will provide the total number of employees in each dept?
(A) SELECT column Dept
(B) GROUP BY Dept
(C) COUNT(*) the total number of employees
(D) FROM the table EMPLOYEES
Solution
The query that gives the number of employees in each department is:
The clauses must appear in the order SELECT, FROM, GROUP BY, so the statements go in this order:
(A) SELECT column Dept
(C) COUNT(*) the total number of employees (part of the SELECT list)
(D) FROM the table EMPLOYEES
(B) GROUP BY Dept
Option 1: GROUP BY cannot come before FROM, because the table must be named before its rows are grouped.
Related questions:
2025: 30 May Shift 2
2026: 18 May Shift 2
2025: 20 May Shift 1
2025: 15 May Shift 2