I am not being able to produce the desired results of this question:
Display alphabetically the full name, job, salary, department number for each employee who earns less than the best paid unionized employee
- unionized employees are not managers presidents of vice presidents And do not work in SALES or MARKETING departments
- Full name should be displayed as Firstname Lastname and should have the heading Employee.
- Salary should be left-padded with the = symbol till the width of 12 characters. It should have an alias Salary.
- salary is formatted as a currency amount incl. thousand separator, but no decimals
- Limit the width of the Employees name to 25 characters.
The output lines should look like this sample line:
Jonathon Taylor SA_REP ==== $8,600 80
My query so far:
select last_name || ', ' || first_name "full name", job_id, salary, department_id
from employees
where salary < ANY
(SELECT MAX(salary)
from employees e join departments d
where e.job_id <> 'AC_MGR' OR 'AD_VP' OR 'AD_PRES'
AND d.department_name <> 'SALES' OR 'MARKETING'
GROUP BY department_id)
If someone can help me out and point me in the right direction of how to get the proper output, that would be greatly appreciated. Thank you!
ORs. Actually that expression isn't even valid: you wante.job not in ('AC_MGR', 'AD_VP', 'AD_PRES'). Same withdepartment_name. And agreed that you don't need theGROUP BYeither. And once your subquery returns a single row theANYwill no longer be necessary.