﻿ SQL SUBQUERIES: Display all the information of an employee whose salary and reporting person id is 3000 and 121 respectively. - w3resource

# SQL Subquery Exercises: Display all the information of an employee whose salary and reporting person id is 3000 and 121 respectively

## SQL SUBQUERY: Exercise-7 with Solution

From the following table, write a SQL query to find the employee whose salary is 3000 and reporting person’s ID is 121. Return all fields.

Sample table: employees

Sample Solution:

``````SELECT *
FROM employees
WHERE (salary,manager_id)=
(SELECT 3000,121);
``````

Sample Output:

```employee_id	first_name	last_name	email	phone_number	hire_date	job_id	salary	commission_pct	manager_id	department_id
187		Anthony		Cabrio		ACABRIO	650.509.4876	2007-02-07	SH_CLERK	3000.00	0.00	121		50
```

Pictorial Presentation:

## Query Visualization:

Duration:

Rows:

Cost:

Contribute your code and comments through Disqus.

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