Question
write SQL query for this question: The given query finds all employees whose salary is higher than Taylors salary: SELECT last_name FROM employees WHERE salary
write SQL query for this question:
The given query finds all employees whose salary is higher than Taylors salary:
SELECT last_name
FROM employees
WHERE salary >
(SELECT salary
FROM employees
WHERE last_name='Taylor')
ORDER BY last_name;
The query runs successfully if last_name is unique. Two variations were given that will run
without error no matter what value is provided. The first solution was as follows:
SELECT last_name
FROM employees
WHERE salary > ALL
(SELECT salary
FROM employees
WHERE last_name='Taylor')
ORDER BY last_name;
The second solution was as follows:
SELECT last_name
FROM employees
WHERE salary >
(SELECT max(salary)
FROM employees
WHERE last_name='Taylor')
ORDER BY last_name;
There are other queries that will run successfully; construct two other solutions, one using the
ANY comparison operator, the other using the MIN aggregation function. Now that you have four solutions, do they all give the same result?
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started