w3resource
SQL exercises

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

Write a query to display the name ( first name and last name ) for those employees who gets more salary than the employee whose id is 163.

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

Practice Online


Query Visualization:

Duration:

Query visualization of Display the name for those employees who gets more salary than the employee whose id is 163 - Duration

Rows:

Query visualization of Display the name for those employees who gets more salary than the employee whose id is 163 - Rows

Cost:

Query visualization of Display the name for those employees who gets more salary than the employee whose id is 163 - Cost

Contribute your code and comments through Disqus.

Previous: SQL SUBQUERIES Exercises Home
Next: Write a query to display the name ( first name and last name ), salary, department id, job id for those employees who works in the same designation as the employee works whose id is 169.

What is the difficulty level of this exercise?



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