nerdexam
Oracle

1Z0-061 · Question #251

You need to write a SQL statement that returns employee name, salary, department ID, and maximum salary earned in the department of the employee for all employees who earn less than the maximum…

The correct answer is B. dept_id = b.dept_id AND a.sal < MAX(sal) GROUP BY b.dept_id. function MAX(column_name)

Using Subqueries to Solve Queries

Question

You need to write a SQL statement that returns employee name, salary, department ID, and maximum salary earned in the department of the employee for all employees who earn less than the maximum salary in their department. Which statement accomplishes this task?

Options

  • ASELECT a.emp_name, a.sal, b.dept_id, MAX(sal) FROM employees a, departments b WHERE
  • Bdept_id = b.dept_id AND a.sal < MAX(sal) GROUP BY b.dept_id;
  • CSELECT a.emp_name, a.sal, a.dept_id, b.maxsal FROM employees a, (SELECT dept_id,
  • DSELECT a.emp_name, a.sal, a.dept_id, b.maxsal FROM employees a WHERE a.sal < (SELECT
  • ESELECT emp_name, sal, dept_id, maxsal FROM employees, (SELECT dept_id, MAX(sal) maxsal

How the community answered

(26 responses)
  • A
    15% (4)
  • B
    73% (19)
  • C
    8% (2)
  • E
    4% (1)

Explanation

function MAX(column_name)

Topics

#inline view#correlated subquery#MAX salary#joins

Community Discussion

No community discussion yet for this question.

Full 1Z0-061 Practice