Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The HR department needs a report that displays the last name, department number, and job ID of all employees whose department location ID is 1800

The HR department needs a report that displays the last name, department number, and job ID of all employees whose department location ID is 1800 (NOTE: the location ID is a column attribute from the DEPARTMENTS table, not the EMPLOYEES table). Write this SQL statement as a subquery.

A fellow Database professional is attempting to create a report for HR that displays the last name and salary of every employee who reports to Steven King (in other words each employee who is assigned the manager_id that corresponds to the manager whose last name is King. The database professional created the SQL statement below, but unfortunately received the error following the code.

SELECT last_name, salary

FROM employees

WHERE manager_id = (SELECT employee_id

FROM employees

WHERE last_name = 'King');

ERROR RESULT:

image text in transcribed

A. Why did the database professional receive that error result?

B. How would you correct the code (write and run your corrected code)?

Create a report for HR that displays the department number, last name, and job ID for every employee in the Executive department (HINT: would you use an = or IN ?).

ERROR RESULT: 2 E SQL | Executing:SELECT last_name, salary FROM ORA-01427: single-row subquery returns more than one row 01427.00000 - "single-row subquery returns more than one row" *Cause: *Action: ERROR RESULT: 2 E SQL | Executing:SELECT last_name, salary FROM ORA-01427: single-row subquery returns more than one row 01427.00000 - "single-row subquery returns more than one row" *Cause: *Action

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional Microsoft SQL Server 2014 Integration Services

Authors: Brian Knight, Devin Knight

1st Edition

1118850904, 9781118850909

More Books

Students also viewed these Databases questions

Question

=+Explain the key responsibilities of each social media role

Answered: 1 week ago

Question

LO1 Identify why performance management is necessary.

Answered: 1 week ago