SQLite Exercise: Get the average salary for each job ID excluding programmer
Write a query to get the average salary for each job ID excluding programmer.
SQLite Code :
Sample table : employees
SQLite Code:
SELECT job_id, AVG(salary)
FROM employees
WHERE job_id <> 'IT_PROG'
GROUP BY job_id;
Output:
job_id AVG(salary) ---------- ----------- AC_ACCOUNT 8300.0 AC_MGR 12000.0 AD_ASST 4400.0 AD_PRES 24000.0 AD_VP 17000.0 FI_ACCOUNT 7920.0 FI_MGR 12000.0 HR_REP 6500.0 MK_MAN 13000.0 MK_REP 6000.0 PR_REP 10000.0 PU_CLERK 2780.0 PU_MAN 11000.0 SA_MAN 12200.0 SA_REP 8350.0 SH_CLERK 3215.0 ST_CLERK 2785.0 ST_MAN 7280.0
Practice SQLite Online
Model Database
Structure of 'hr' database :
Improve this sample solution and post your code through Disqus.
Previous: Write a query to get the department ID and the total salary payable in each department.
Next: Write a query to get the total salary, maximum, minimum, average salary of employees (job ID wise), for department ID 90 only.
What is the difficulty level of this exercise?
- New Content published on w3resource:
- HTML-CSS Practical: Exercises, Practice, Solution
- Java Regular Expression: Exercises, Practice, Solution
- Scala Programming Exercises, Practice, Solution
- Python Itertools exercises
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework
- Angular - JavaScript Framework
- Vue - JavaScript Framework
- Jest - JavaScript Testing Framework