Fred
asked on
Using Joins to categorize
The Stg_Emp table contains all new & current employee `1, John Doe 2, Jane Doe 3, Sally Mae
The Emp_List table contains some current & all former employees 1, John Doe 2, Jane Doe 5, Peggy Sue
ASSIGNMENT: Write two scripts using JOIN to:
Show the Company’s new employee John Doe and Jane doe ?
SELECT *
from dbo.Stg_Emp
LEFT JOIN dbo.Emp_List
on dbo.Stg_Emp.EmpName = dbo.Emp_List.EmpName
---John Doe and Jane Doe
Show the Company’s former employee Peggy Sue ?
SELECT *
from dbo.Stg_Emp
RIGHT JOIN dbo.Emp_List
on dbo.Stg_Emp.EmpName = dbo.Emp_List.EmpName
Not sure if my Results are Correct John Doe and Jane Doe are Both New Employees and Peggy Sue is a Former Employee ? Then where does Sally Mae fall into ? How can I use a join to categorize where she falls into
The Emp_List table contains some current & all former employees 1, John Doe 2, Jane Doe 5, Peggy Sue
ASSIGNMENT: Write two scripts using JOIN to:
Show the Company’s new employee John Doe and Jane doe ?
SELECT *
from dbo.Stg_Emp
LEFT JOIN dbo.Emp_List
on dbo.Stg_Emp.EmpName = dbo.Emp_List.EmpName
---John Doe and Jane Doe
Show the Company’s former employee Peggy Sue ?
SELECT *
from dbo.Stg_Emp
RIGHT JOIN dbo.Emp_List
on dbo.Stg_Emp.EmpName = dbo.Emp_List.EmpName
Not sure if my Results are Correct John Doe and Jane Doe are Both New Employees and Peggy Sue is a Former Employee ? Then where does Sally Mae fall into ? How can I use a join to categorize where she falls into
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.