nerdexam
Oracle

1Z0-007 · Question #80

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. SELECT a.emp_name, a.sal, a.dept_id, b.maxsal FROM employees a, (SELECT. function MAX(column_name) Incorrect answer: A invalid statement C inner query return more than one line D column maxsal does not exists.

Displaying Data from Multiple Tables and Subqueries

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
  • BSELECT a.emp_name, a.sal, a.dept_id, b.maxsal FROM employees a, (SELECT
  • CSELECT a.emp_name, a.sal, a.dept_id, b.maxsal FROM employees a WHERE a.sal <
  • DSELECT emp_name, sal, dept_id, maxsal FROM employees, (SELECT dept_id,

How the community answered

(34 responses)
  • A
    12% (4)
  • B
    79% (27)
  • C
    6% (2)
  • D
    3% (1)

Explanation

function MAX(column_name) Incorrect answer: A invalid statement C inner query return more than one line D column maxsal does not exists.

Topics

#inline view#MAX per group#correlated subquery#multi-table join

Community Discussion

No community discussion yet for this question.

Full 1Z0-007 Practice