w3resource
SQL exercises

SQL Subquery Exercises: Determine who earns more than Mr. Ozer

SQL SUBQUERY: Exercise-29 with Solution

Write a query to determine who earns more than Mr. Ozer.

Sample table: employees


Sample Solution:

SELECT first_name, last_name, salary 
FROM employees 
WHERE salary > 
(SELECT salary 
FROM employees 
WHERE last_name='Ozer') 
ORDER BY  last_name;

Sample Output:

first_name	last_name	salary
Lex		De Haan		17000.00
Alberto		Errazuriz	12000.00
Nancy		Greenberg	12000.00
Michael		Hartstein	13000.00
Shelley		Higgins		12000.00
Steven		King		24000.00
Neena		Kochhar		17000.00
Karen		Partners	13500.00
John		Russell		14000.00

Practice Online


Query Visualization:

Duration:

Query visualization of Determine who earns more than Mr. Ozer - Duration

Rows:

Query visualization of Determine who earns more than Mr. Ozer - Rows

Cost:

Query visualization of Determine who earns more than Mr. Ozer - Cost

Have another way to solve this solution? Contribute your code (and comments) through Disqus.

Previous: Write a query to identify all the employees who earn more than the average and who work in any of the IT departments.
Next: Write a query to find out which employees have a manager who works for a department based in the US.

What is the difficulty level of this exercise?



New Content: Composer: Dependency manager for PHP, R Programming