SQL Subquery Exercises: Display the name for those employees who gets more salary than the employee whose id is 163
SQL SUBQUERY: Exercise-1 with Solution
From the following table, write a SQL query to find those employees who receive a higher salary than the employee with ID 163. Return first name, last name.
Sample table: employees
Sample Solution:
SELECT first_name, last_name
FROM employees
WHERE salary >
( SELECT salary
FROM employees
WHERE employee_id=163
);
Sample Output:
first_name last_name Steven King Neena Kochhar Lex De Haan Nancy Greenberg Den Raphaely John Russell Karen Partners Alberto Errazuriz Gerald Cambrault Eleni Zlotkey Peter Tucker Janette King Clara Vishney Lisa Ozer Harrison Bloom Tayler Fox Ellen Abel Michael Hartstein Hermann Baer Shelley Higgins
Pictorial Presentation:

Practice Online
Query Visualization:
Duration:

Rows:

Cost:

Contribute your code and comments through Disqus.
Previous: SQL SUBQUERIES Exercises Home
Next: From the following table, write a SQL query to find those employees whose designation is the same as the employee whose ID is 169. Return first name, last name, department ID and job ID.
Test your Programming skills with w3resource's quiz.
What is the difficulty level of this exercise?
SQL: Tips of the Day
"where 1=1" statement?
It's usually when folks build up SQL statements.
When you add and value = "Toyota" you don't have to worry about whether there is a condition before or just WHERE.
Ref: https://bit.ly/3cayyhJ
- Exercises: Weekly Top 12 Most Popular Topics
- Pandas DataFrame: Exercises, Practice, Solution
- Conversion Tools
- JavaScript: HTML Form Validation
- SQL Exercises, Practice, Solution - SUBQUERIES
- C Programming Exercises, Practice, Solution : For Loop
- Python Exercises, Practice, Solution
- Python Data Type: List - Exercises, Practice, Solution
- C++ Basic: Exercises, Practice, Solution
- SQL Exercises, Practice, Solution - exercises on Employee Database
- SQL Exercises, Practice, Solution - exercises on Movie Database
- SQL Exercises, Practice, Solution - exercises on Soccer Database
- C Programming Exercises, Practice, Solution : Recursion