SQL SORTING and FILTERING on HR Database: Display the full name, and department number for those employees who works either in department 70 or 90
SQL SORTING and FILTERING on HR Database: Exercise-13 with Solution
13. From the following table, write a SQL query to find those employees who works either in department 70 or 90. Return full name (first and last name), department id.
Sample table : employees
Sample Solution:
SELECT first_name ||' '|| last_name AS Full_Name, department_id
FROM employees
WHERE department_id = 70
OR department_id = 90;
OR
SELECT first_name ||' '|| last_name AS Full_Name, department_id
FROM employees
WHERE department_id IN (70 , 90);
Sample Output:
full_name | department_id ---------------+--------------- Steven King | 90 Neena Kochhar | 90 Lex De Haan | 90 Hermann Baer | 70 (4 rows)
Practice Online

Query Visualization for Sample Solution:
Duration:

Rows:

Cost:

Query Visualization for alternate Sample Solution:
Duration:

Rows:

Cost:

Contribute your code and comments through Disqus.
Previous: From the following table, write a SQL query to find those employees who were hired during November 5th, 2007 and July 5th, 2009. Return full name (first and last), job id and hire date.
Next: From the following table, write a SQL query to find those employees who work under a manager. Return full name (first and last name), salary, and manager ID.
Test your Programming skills with w3resource's quiz.
What is the difficulty level of this exercise?
SQL: Tips of the Day
MySQL export schema without data
mysqldump -h yourhostnameorIP -u root -p --no-data dbname > schema.sql
Ref: https://bit.ly/3xzB9dS
- New Content published on w3resource:
- HTML-CSS Practical: Exercises, Practice, Solution
- Java Regular Expression: Exercises, Practice, Solution
- Scala Programming Exercises, Practice, Solution
- Python Itertools exercises
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework
- Angular - JavaScript Framework
- Vue - JavaScript Framework
- Jest - JavaScript Testing Framework