Complete the code to select the name and the highest salary from the employees table using a scalar subquery.
SELECT name, (SELECT [1] FROM employees) AS max_salary FROM employees;The scalar subquery must return the maximum salary, so MAX(salary) is correct.
Complete the code to find employees whose salary is equal to the average salary using a scalar subquery.
SELECT name FROM employees WHERE salary = (SELECT [1] FROM employees);The scalar subquery should return the average salary, so AVG(salary) is correct.
Fix the error in the scalar subquery to correctly find employees with salary greater than the average salary.
SELECT name FROM employees WHERE salary > (SELECT [1]salary FROM employees);The scalar subquery must use AVG(salary) to get the average salary for comparison.
Fill both blanks to select employees whose salary is between the minimum and maximum salary using scalar subqueries.
SELECT name FROM employees WHERE salary BETWEEN (SELECT [1](salary) FROM employees) AND (SELECT [2](salary) FROM employees);
The salary should be between the minimum and maximum salaries, so MIN and MAX are correct.
Fill all three blanks to select employees whose salary is greater than the average salary but less than the maximum salary.
SELECT name FROM employees WHERE salary > (SELECT [1](salary) FROM employees) AND salary < (SELECT [2](salary) FROM employees) ORDER BY [3];
The query compares salary to average and maximum salaries, so AVG and MAX are correct. Ordering by salary sorts the results by salary.