Question
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
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started