SELECTd.dept_name, COUNT(DISTINCT e.emp_id)
FROM emp_master e, dept_master d
WHERE e.dept_id=d.dept_id
GROUP BY e.dept_id;
https://www.tutlane.com/tutorial/sqlite/sqlite-count-function#:~:text=Generally%20in%20SQLite%2C%20we%20use,employees%20count%20from%20each%20department.