SHARE
TWEET

Untitled

a guest Nov 19th, 2019 89 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. =============================v 29 ========================
  2. select last_name, salary,job_id, d.department_id, department_name,
  3. (select count(employee_id) from employees where department_id=d.department_id) nr,
  4. (select avg(salary) from employees where department_id=d.department_id) medie
  5. from employees e right join departments d on(e.department_id=d.department_id);
  6. =============================v 29 ========================
  7. =============================v 34 ========================
  8. select last_name, salary,job_id, d.department_id, department_name, nr, medie
  9. from employees e right join
  10.                     (select department_id, department_name,count(employee_id) nr, avg(salary) medie
  11.                      from employees right join departments using(department_id)
  12.                     group by department_id,department_name) d on(e.department_id=d.department_id);
  13.  
  14. with aux as
  15.         (select department_id, department_name,count(employee_id) nr, avg(salary) medie
  16.                      from employees right join departments using(department_id)
  17.                     group by department_id,department_name)
  18.                    
  19. select last_name, salary,job_id, d.department_id, department_name, nr, medie
  20. from employees e right join aux d on(e.department_id=d.department_id);
  21. =============================v 34 ========================
  22. =============================v 22 ========================
  23. select afis.last_name, afis.salary,afis.job_id, d.department_id, department_name, count(t_count_avg.employee_id) nr,
  24. avg(t_count_avg.salary) medie
  25. from employees afis right join departments d on(afis.department_id=d.department_id)
  26. join employees t_count_avg on(afis.department_id=t_count_avg.department_id)
  27. group by afis.last_name, afis.salary,afis.job_id, d.department_id, department_name;
  28. =============================v 22 ========================
  29. =============================v 28 ========================
  30. select (select count(*) from employees) ,
  31. (select count(*) from employees where to_char(hire_date,'yyyy')=1997) An1997,
  32. (select count(*) from employees where to_char(hire_date,'yyyy')=1998) An1998,
  33. (select count(*) from employees where to_char(hire_date,'yyyy')=1999) An1999,
  34. (select count(*) from employees where to_char(hire_date,'yyyy')=2000) An2000
  35. from dual;
  36. =============================v 28 ========================
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top