QuestionQ274

VerifiedReporting Aggregated Data Using the Group Functions

Review the description of the EMPLOYEES table:

  • EMP_ID NUMBER(4) NOT NULL -
  • LAST_NAME VARCHAR2(30) NOT NULL -
  • FIRST_NAME VARCHAR2(30)
  • DEPT_ID NUMBER(2)

Which statement returns the number of distinct departments that have employees whose last name is Smith?

Explanation

COUNT(DISTINCT dept_id) counts each non-null department identifier once after filtering the rows to employees with LAST_NAME equal to Smith.

Community Discussion

No comments yet. Be the first to start the discussion!