w3resource
ankara escort
malatya escort
SQLite exercises

SQLite Exercise: Get the number of employees with the same job

Write a query to get the number of employees with the same job.

Sample table : employees


SQLite Code:

SELECT job_id, COUNT(*)
FROM employees
GROUP BY job_id;

Output:

job_id      COUNT(*)
----------  ---------
AC_ACCOUNT  1
AC_MGR      1
AD_ASST     1
AD_PRES     1
AD_VP       2
FI_ACCOUNT  5
FI_MGR      1
HR_REP      1
IT_PROG     5
MK_MAN      1
MK_REP      1
PR_REP      1
PU_CLERK    5
PU_MAN      1
SA_MAN      5
SA_REP      30
SH_CLERK    20
ST_CLERK    20
ST_MAN      5

Sqlite Online Editor


Structure of 'hr' database :

hr database

Improve this sample solution and post your code through Disqus.

Previous: Write a query to get the highest, lowest, sum, and average salary of all employees.
Next: Write a query to get the difference between the highest and lowest salaries.

What is the difficulty level of this exercise?

New Exercises:R Programming