Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

MySQL/PHP Database Applications

Authors: Brad Bulger, Jay Greenspan, David Wall

2nd Edition

ISBN: 0764549634, 9780764549632

More Books

Students also viewed these Databases questions

Question

f. Did they change their names? For what reasons?

Answered: 1 week ago