ITPEC FE Morning April 2018 Question 29
ITPEC FE Morning April 2018 — Question 29 of 80
SQL COUNT with JOIN — count rows from a cross-table query with a WHERE filter.
The query joins Employee and Department on Employee.Department = Department.Department_name, then filters Floor = 2.
Step-by-step:
- Departments on Floor 2: Information systems, Accounting, Legal affairs, Procurement
- Employees in those departments:
- 11002 → Accounting ✓
- 11005 → Information systems ✓
- 12002 → Information systems ✓
- No employees in Legal affairs or Procurement
- COUNT(*) = 3
Answer: (c) 3
Why not others:
- (a) 1 — undercounts; multiple employees match the condition
- (b) 2 — misses either the Accounting or one Information systems employee
- (d) 4 — counts the number of Floor-2 departments (4), not the number of matching employees (3)
Key rule: COUNT(*) counts result rows, not distinct departments. An empty department contributes zero rows to an inner join.
AI-generated — may contain errors
The original exam layout is preserved in the image so diagrams, formulas, tables, and code remain accurate.
This question comes from an official ITPEC past paper. ITPEC Practice is an independent study tool and is not affiliated with ITPEC. See the official FE past-paper collection or Report an issue.