Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I need help creating a query for all employees: Employee ID First and Last Name Department Name Current Salary Last Raise Date We kindly ask
I need help creating a query for all employees:
Employee ID
First and Last Name
Department Name
Current Salary
Last Raise Date
We kindly ask that you provide us with this report by May th so that we can review and analyze the data.
dbo.ErrorLog
HumanResources. Department
Columns
DepartmentID PK smallint,
SQLQuerysql SHI...SHIELAlshiel SQLQuerysql not connected
SQLQuerysql not connected
playerdbsql not connected
SELECT EHumanResources.EmployeePayHistory, EHumanResources.Department,
EName, EBusinessEntityID AS EmployeeID, EDepartmentID, ESalariedFlat, ERateChangeDate AS RCRate AS CurrentSalary, MDModifiedDate AS LastRaiseDate FROM EmployeePayHistory AS E Department AS H INNER JOIN Departments d ON eDepartmentID dDepartmentID
WHERE LastRaiseDate DATEADDmonth GETDATE OR LastRaiseDate IS NULL ORDER BY
eName;
Name Namenvarchar
G GroupName Namenvarcha
ModifiedDate datetime no
HumanResources.Employee
HumanResources.EmployeeDep
HumanResources.EmployeePay
E Columns
BusinessEntityID PK FK int
Messages
Msg Level State Line
Incorrect syntax near
RateChangeDate PK dateti
Rate money not null
PayFrequency tinyint not
B ModifiedDate datetime no
Completion time: :::
Please include the following features in your report.
Include our company logo
Include a title of the report named Employee Salary History.
Flag any employee who has not had a raise in over months. You can either color code the output or create a widget indicator.
Include all the information mentioned above.
Make the report sortable by the employee's last name.
We would also like an export of the report in Excel format to share with our coworkers. I have to filter out employees who have not had a raise in months or more.
le Edit View Query Project Tools Window Help
Execute
SQLQuerysql SHI...SHIELAlshiel
SQLQuerysql SHI...SHIELAIshiel SQLQuerysql not connected
File Tables
External Tables
Graph Tables
dbo.AWBuildVersion
dbo.DatabaseLog
IboErrorLog
HumanResources.Department
Columns
DepartmentID PK smallini
Name Namenvarchar
GroupName Namenvarch GELECT EBusinessEntityID AS EmployeeID,
EName,
DName AS DepartmentName, EPH.Rate AS CurrentSalary, EPH. RateChangeDate AS LastRaiseDate, CASE
WHEN EPH. RateChangeDate IS NULL OR EPH. RateChangeDate DATEADDmonth GETDATE THEN No Raise in Months'
ELSE OK
END AS RaiseStatus
FROM HumanResources.EmployeePayHistory EPH
JOIN HumanResources.Employee E ON EPH.BusinessEntityIDEBusinessEntityID
JOIN HumanResources.EmployeeDepartmentHisotry EDH ON E BusinessEntityIDEDH. BusinessEntityID
JOIN HumanResources.Department D ON EDH.DepartmentIDDDepartmentID
WHERE EDH. EndDate IS NULL
ORDER BY
EName;
ModifiedDate datetime
Keys
Constraints
Triggers
Indexes
Statistics
HumanResources.Employee
HumanResources.EmployeeDe
HumanResources.EmployeePa
Columns
BusinessEntityID PK FK in
RateChangeDate PK date
Rate money not null
PayFrequency tinyint not
ModifiedDate datetime ns
Messages
Msg Level State Line
Invalid object name 'HumanResources.EmployeePayHistory'.
Completion time: T:::
Query completed with errors.
SHIELAISQLDEVELOPER RTM SHIELAlshiel master
This is what i have but it will not work & keeps giving me an error.
New Query
Execute
XMLA
a
design query editor
@
SQLQuerysql SHI...SHIELAlshiel SQLQuerysql SHI...SHIELAlshiel
SELECT EBusinessEntityID AS EmployeeID, EFirstName, ELastName,
DName AS DepartmentName, EPH.Rate AS CurrentSalary, EPH. RateChangeDate AS LastRaiseDate,
CASE WHEN EPH.RateChangeDate IS NULL OR EPH.RateChangeDate DATEADDmonth GETDATE
THEN No Raise in Months'
ELSE OK END AS RaiseStatus
FROM HumanResources. EmployeePayHistory
JOIN HumanResources.Employee E ON EPH.BusinessEntityID EBusinessEntityID
JOIN HumanResources. EmployeeDepartmentHisotry EDH ON EBusinessEntityID EDH.BusinessEntityID
JOIN HumanResources.Department D ON EDH.DepartmentID DDepartmentID
WHERE EDH. EndDate IS NULL
ORDER BY ELastName;
Messages
Msg Level State Line
Invalid object name 'HumanResources.EmployeePayHistory'.
Completion time:
No matter what I do I keep getting error code. I have put EPH after "FROM HumanResources.EmployeePayHistory" but it tells me that is an invalid object name
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