Please note, this is a STATIC archive of website www.w3resource.com from 19 Jul 2022, cach3.com does not collect or store any user information, there is no "phishing" involved.
w3resource

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

Employee Model  Database - w3resource online SQLite practice

Structure of 'hr' database :

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?