add batch remove batch split batch comment selection show hidden batches hide batch highlight batch
db<>fiddle
donate feedback about
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
CREATE TABLE your_tab(WorkerId INT, Salary INT, DepartmentId INT);


INSERT INTO your_tab VALUES (10001, 2000.00, 1);
1 rows affected
INSERT INTO your_tab VALUES (10002, 2500.00, 2);
1 rows affected
INSERT INTO your_tab VALUES (10005, 3500.00, 1);
1 rows affected
INSERT INTO your_tab VALUES (10004, 3000.00, 1);
1 rows affected
SELECT yt.DepartmentId, t.hs/count(*) * 100
FROM your_tab yt
JOIN
(
SELECT DepartmentId, count(*) as hs
FROM your_tab
WHERE salary > 2100
GROUP BY DepartmentId
) t ON yt.DepartmentId = t.DepartmentId
GROUP BY yt.DepartmentId, t.hs
DEPARTMENTID T.HS/COUNT(*)*100
2 100
1 66.66666666666666666666666666666666666667