Medium
Advanced SQL Query
Write a complex SQL query involving joins and aggregation.
📝 提示内容
Write a SQL query for a database with two tables: 'Employees' (id, name, department_id) and 'Salaries' (employee_id, amount, year). The query should list the names of employees in the 'Sales' department who earned an average salary higher than $50,000 over the years available in the database. Sort the results by the average salary in descending order.