Calculate average salary per department.
Toolliyo Coach
Progressive help: Nudge → Guide → Approach. Full solution stays behind the Solution tab.
Editor is open — no login wall to practice.
| Test | Status | Details |
|---|
Ready — edit the code above and click Run or Submit.
-- Sample schema
CREATE TABLE Employees (Id INT, Name TEXT, DeptId INT, Salary INT);
CREATE TABLE Departments (Id INT, Name TEXT);
INSERT INTO Employees VALUES (1,'Ali',1,90000),(2,'Sara',2,120000),(3,'Raj',1,75000);
INSERT INTO Departments VALUES (1,'Engineering'),(2,'Sales');
SELECT d.Name, AVG(e.Salary) AS AvgSalary
FROM Employees e
JOIN Departments d ON e.DeptId = d.Id
GROUP BY d.Name;
Prefer Coach (Nudge → Guide → Approach) before revealing. No forced signup.
GROUP BY with aggregate functions—SQL interview staple.
Sign in to save and review your submission history. You can still Run code on the Editor tab as a guest.
Sign in