w3resource
SQL exercises

SQL Subquery Exercises: Display the department number, name, job and department name for all employees in the Finance department

SQL SUBQUERY : Exercise-6 with Solution

Write a query to display the department number, name ( first name and last name ), job and department name for all employees in the Finance department.

Sample table: employees


Sample table: departments


Sample Solution:

SELECT e.department_id, e.first_name, e.job_id , d.department_name  
FROM employees e , departments d  
WHERE e.department_id = d.department_id  
AND  d.department_name = 'Finance';

Sample Output:

department_id	first_name	job_id		department_name
100		Nancy		FI_MGR			Finance
100		Daniel		FI_ACCOUNT		Finance
100		John		FI_ACCOUNT		Finance
100		Ismael		FI_ACCOUNT		Finance
100		Jose Manuel	FI_ACCOUNT		Finance
100		Luis		FI_ACCOUNT		Finance

Practice Online


Query Visualization:

Duration:

Query visualization of Display the department number, name, job and department name for all employees in the Finance department - Duration

Rows:

Query visualization of Display the department number, name, job and department name for all employees in the Finance department - Rows

Cost:

Query visualization of Display the department number, name, job and department name for all employees in the Finance department - Cost

Contribute your code and comments through Disqus.

Previous: Write a query to display the employee name ( first name and last name ), employee id and salary of all employees who report to Payam.
Next: Write a query to display all the information of an employee whose salary and reporting person id is 3000 and 121 respectively.

What is the difficulty level of this exercise?



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