
Ultimate access to all questions.
You are working as a Fabric Analytics Engineer and are tasked with optimizing a SQL query for a report that analyzes employee salaries across different departments. The dataset includes columns for Department, Position, and Salary. The report requires the highest and lowest salary amounts for each department, along with the department name, to be displayed in ascending order by department name. Additionally, the solution must ensure minimal execution time and resource usage due to the large volume of data. Which SQL query best meets these requirements? (Choose one correct answer)
A
SELECT Department, MAX(Salary) AS HighestSalary, MIN(Salary) AS LowestSalary FROM EmployeeSalaries GROUP BY Department;
B
SELECT Department, MAX(Salary) AS HighestSalary FROM EmployeeSalaries GROUP BY Department UNION SELECT Department, MIN(Salary) AS LowestSalary FROM EmployeeSalaries GROUP BY Department;
C
SELECT Department, MAX(Salary) AS HighestSalary, MIN(Salary) AS LowestSalary FROM EmployeeSalaries;
D
SELECT Department, MAX(Salary) AS HighestSalary, MIN(Salary) AS LowestSalary FROM EmployeeSalaries GROUP BY Department ORDER BY Department;