﻿ SQL SUBQUERIES: Display the city of the employee whose ID 134 and works there - w3resource

# SQL Subquery Exercises: Display the city of the employee whose ID 134 and works there

## SQL SUBQUERY: Exercise-47 with Solution

From the following tables, write a SQL query to find the city of the employee of ID 134. Return city.

Sample table: locations

Sample table: departments

Sample table: employees

Sample Solution:

``````SELECT city
FROM locations
WHERE location_id =
(SELECT location_id
FROM departments
WHERE department_id =
(SELECT department_id
FROM employees
WHERE employee_id=134));
``````

Sample Output:

```city
South San Francisco
```

Pictorial Presentation:

## Query Visualization:

Duration:

Rows:

Cost:

Have another way to solve this solution? 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

How to count occurrences of a column value in SQL?

Input table:

```id | age
--------
0  | 25
1  | 25
2  | 23
```
```SELECT age, count(age)
FROM Students
GROUP by age
```

Output:

```id | age | count
----------------
0  | 25  | 2
1  | 25  | 2
2  | 23  | 1
```

Ref: https://bit.ly/3zbLPQm