﻿ SQL SUBQUERIES: Find those employees who receive a higher salary than the employee with ID 163 - w3resource

# 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:

## Query Visualization:

Duration:

Rows:

Cost:

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