Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT *
- FROM (SELECT e.first_name||' '||e.last_name, e.SALARY, round((sysdate-e.hire_date)/365,2) STAJ, c.country_name FROM employees e, DEPARTMENTS d, LOCATIONS l, COUNTRIES c
- WHERE round((sysdate-hire_date)/365,2)>=10
- AND e.DEPARTMENT_ID=d.DEPARTMENT_ID
- AND d.LOCATION_ID=l.LOCATION_ID
- AND c.COUNTRY_ID=l.COUNTRY_ID
- AND UPPER(c.country_name)=UPPER('United States of America')
- ORDER BY e.SALARY DESC)
- WHERE rownum <= 15
- UNION ALL
- (SELECT *
- FROM (SELECT e.first_name||' '||e.last_name, e.SALARY, round((sysdate-e.hire_date)/365,2) STAJ, c.country_name FROM employees e, DEPARTMENTS d, LOCATIONS l, COUNTRIES c
- WHERE round((sysdate-hire_date)/365,2)<10
- AND e.DEPARTMENT_ID=d.DEPARTMENT_ID
- AND d.LOCATION_ID=l.LOCATION_ID
- AND c.COUNTRY_ID=l.COUNTRY_ID
- AND UPPER(c.country_name)=UPPER('United States of America')
- ORDER BY e.SALARY ASC)
- WHERE rownum <= 15);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement