SELECT d.name, AVG(e.salary) AS average_salary\nFROM departments d LEFT JOIN employees e ON d.id = e.department_id \nGROUP BY d.name;
Write a query that returns the average salary of employees in each department.?