Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.00 KB | None | 0 0
  1. --1
  2. select count (employee_id)
  3. from employees;
  4. --2
  5. select avg(salary)
  6. from pracownicy
  7. where job_id ='IT_PROG';
  8. --3
  9. select count(distinct first_name)
  10. from employees
  11. where first_name like 'A%';
  12. --4
  13. select avg(salary),min(salary),max(salary)
  14. from employees;
  15. --5
  16. select sum(salary), min(salary), max(salary), avg (salary)
  17. from employees
  18. where manager_id is not null;
  19. --6
  20. select sum(salary), job_id
  21. from employees
  22. group by job_id;
  23. --7
  24. select job_id ,count(job_id)
  25. from employees
  26. group by job_id;
  27. --8
  28. select avg(salary), count (employee_id), job_id
  29. from employees
  30. group by job_id
  31. having count (employee_id)>=3;
  32. --9
  33. select first_name, count(first_name)
  34. from employees
  35. group by first_name
  36. having count(first_name)>1
  37. order by count(first_name) desc;
  38. --10
  39. select avg(salary), department_id
  40. from employees
  41. group by department_id
  42. having avg(salary)>9000;
  43. --11
  44. select department_id,min(salary)- max(salary)
  45. from employees
  46. group by department_id;
  47. --12 blad
  48. select menager_id,max(salary)
  49. from employees
  50. group by
  51. order by menager_id;
  52. --13 blad
  53. select department_id, max(salary)
  54. from employees
  55. order by department_id
  56. --14 blad
  57. select count(department_id), department_id,count(distinct department_id)
  58. from employees
  59. group by department_id;
  60. --15
  61. select avg(distinct salary),department_id
  62. from employees
  63. group by department_id;
  64. --16
  65. select max(salary),department_id
  66. from employees
  67. group by department_id
  68. having department_id in (50,60,100);
  69. --17
  70. select min(salary), department_id
  71. from employees
  72. where last_name NOT LIKE '%o%'
  73. group by department_id;
  74. --18
  75. select min(salary),max(salary),department_id
  76. from employees
  77. group by department_id
  78. having count(department_id)<5;
  79. --19
  80. select department_id
  81. from departments
  82. group by department_id
  83. having count (department_id)>1;
  84. --20
  85. select min(hire_date),max(hire_date) department_id
  86. from employees
  87. group by department_id
  88. order by department_id;
  89. --21
  90. select count(employee_id),job_id
  91. from employees
  92. group by job_id
  93. order by 1 desc;
  94. --22
  95. select count(employee_id),job_id
  96. from employees
  97. group by job_id
  98. having count(job_id)>10;
  99. --23
  100. select count (employee_id), avg(salary), job_id
  101. from employees
  102. where hire_date not between to_date ('01-01-2005', 'dd-mm-yyyy') and to_date ('31-12-2005', 'dd-mm-yyyy')
  103. group by job_id;
  104.  
  105. --24 blad
  106. select min(salary),menager_id
  107. from employees
  108. group by menager_id;
  109. --25a
  110. select job_id,avg(salary)
  111. from employees
  112. group by job_id
  113. having job_id in ('ST_CLERK','ST_MAN');
  114.  
  115. --25b
  116. select job_id,avg(salary)
  117. from employees
  118. where job_id in ('ST_CLERK','ST_MAN')
  119. group by job_id;
  120. --26
  121. select max(salary)-min(salary),DEPARTMENT_ID
  122. from employees
  123. where DEPARTMENT_ID in (50,60,100)
  124. group by department_id;
  125. --27
  126. select avg(salary),department_id,
  127. from employees
  128. where department_id in(70,80,110)and not between hire_date to_date('01-01-2014','dd-mm-yyy')
  129. and hire_date to_date('31-12-2015','dd-mm-yyy'
  130. order by department_id;
  131. --28
  132.  
  133.  
  134. --29
  135.  
  136. --30
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement