1Z0-007 · Question #146
Evaluate the SQL statement: 1 SELECT a.emp_name, a.sal, a.dept_id, b.maxsal 2 FROM employees a, 3 (SELECT dept_id, MAX(sal) maxsal 4. FROM employees 5. GROUP BY dept_id) b 6. WHERE a.dept_id =…
The correct answer is E. The statement returns the employee name, salary, department ID, and maximum salary earned in. The statement returns the 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. This query is example of an inline view which is the sub-query in the FROM…
Question
Options
- AThe statement produces an error at line 1.
- BThe statement produces an error at line 3.
- CThe statement produces an error at line 6.
- DThe statement returns the employee name, salary, department ID, and maximum salary earned in
- EThe statement returns the employee name, salary, department ID, and maximum salary earned in
How the community answered
(38 responses)- A8% (3)
- B13% (5)
- C3% (1)
- D3% (1)
- E74% (28)
Explanation
The statement returns the 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. This query is example of an inline view which is the sub-query in the FROM clause of the main query. The sub-query can be a SELECT statement that utilizes joins, the GROUP BY clause, or the ORDER BY clause. Incorrect Answers A: The statement does not produce an error at line 1. B: The statement does not produce an error at line 3. C: The statement does not produce an error at line 6. D: The statement returns the employee name, salary, department ID, and maximum salary earned in the department of the employee for all EMPLOYEES, NOT DEPARTMENTS, who earn less than the maximum salary in their department.
Topics
Community Discussion
No community discussion yet for this question.