SQLite Exercise: Display the department ID, department name, and manager first name
Write a query to display the department ID, department name, and manager first name.
Sample table : employees
Sample table : departments
SQLite Code:
SELECT d.department_id, d.depart_name, e.manager_id, e.first_name
FROM departments d
INNER JOIN employees e
ON (d.manager_id = e.employee_id);
Output:
department_id depart_name manager_id first_name ------------- -------------- ---------- ---------- 10 Administration 101 Jennifer 20 Marketing 100 Michael 30 Purchasing 100 Den 40 Human Resource 101 Susan 50 Shipping 100 Adam 60 IT 102 Alexander 70 Public Relatio 101 Hermann 80 Sales 100 John 90 Executive Steven 100 Finance 101 Nancy 110 Accounting 101 Shelley
Practice SQLite Online
Model Database
Structure of 'hr' database :
Improve this sample solution and post your code through Disqus.
Previous: Write a query to find the employee ID, job title number of days between ending date and starting date for all jobs in department 90 from job history.
Next: Write a query to display the department name, manager name, and city.
What is the difficulty level of this exercise?
- 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