SQL JOINS on HR Database: HR: Display the job title, department name, full name, and starting date for all the jobs which started between 1st January, 1993 and 31 August, 1997.
SQL JOINS on HR Database: Exercise-13 with Solution
13. From the following tables, write a SQL query to find those employees who joined between 1st January 1993 and 31 August 1997. Return job title, department name, employee name, and joining date of the job.
Sample table: job_history
Sample table: jobs
Sample table: departments
Sample table: employees
Sample Solution:
SELECT job_title, department_name, first_name || ' ' || last_name AS Employee_name, start_date
FROM job_history
JOIN jobs USING (job_id)
JOIN departments USING (department_id)
JOIN employees USING (employee_id)
WHERE start_date>='1993-01-01' AND start_date<='1997-08-31';
Sample Output:
job_title department_name employee_name start_date Administration Assistant Executive Jennifer Whalen 1995-09-17
Pictorial Presentation:
Practice Online
Query Visualization:
Duration:
Rows:
Cost:
Have another way to solve this solution? Contribute your code (and comments) through Disqus.
Previous: From the following tables, write a SQL query to find those employees who work in a department where the employee of last name 'Taylor' works. Return first name, last name and department ID.
Next: From the following tables, write a SQL query to find the difference between maximum salary of the job and salary of the employees. Return job title, employee name, and salary difference.
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.
SQL: Tips of the Day
SQL Server SELECT into existing table.
INSERT INTO dbo.TABLETWO SELECT col1, col2 FROM dbo.TABLEONE WHERE col3 LIKE @search_key
This assumes there's only two columns in dbo.TABLETWO - you need to specify the columns otherwise:
INSERT INTO dbo.TABLETWO (col1, col2) SELECT col1, col2 FROM dbo.TABLEONE WHERE col3 LIKE @search_key
Database: SQL Server
Ref: https://bit.ly/3y6tpA3
- 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