Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Schema Question: List all of the current employees first name, last name, salary and department name ( 265332 rows returned ) My query: SELECT employees.first_name

Schema

image text in transcribed

Question: List all of the current employees first name, last name, salary and department name (265332 rows returned)

My query:

SELECT employees.first_name AS 'First Name',

employees.last_name AS 'Last Name',

salaries.salary AS 'Salary',

departments.dept_name AS 'Department'

FROM employees

INNER JOIN salaries ON employees.emp_no = salaries.emp_no

INNER JOIN dept_emp ON employees.emp_no = dept_emp.emp_no

LEFT JOIN departments ON dept_emp.dept_no = departments.dept_no

ORDER BY employees.first_name, employees.last_name;

Returns 3142095 rows. Most of them are duplicate. How do I fix it? Please explain with steps and not just answer.

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_2

Step: 3

blur-text-image_3

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

Database Security

Authors: Alfred Basta, Melissa Zgola

1st Edition

1435453905, 978-1435453906

More Books

Students also viewed these Databases questions

Question

Describe how a risk matrix is constructed.

Answered: 1 week ago

Question

Factor the given expressions completely. 6x 2 + x 5

Answered: 1 week ago

Question

Question What are the requirements for a safe harbor 401(k) plan?30

Answered: 1 week ago