w3resource
SQL exercises

SQL JOINS on HR Database: Display the job title, department name, full name, and starting date for all the jobs which started on or after 1st January, 1993 and ending with on or before 31 August, 1997

SQL JOINS on HR Database: Exercise-13 with Solution

13. Write a query in SQL to display the job title, department name, full name (first and last name ) of employee, and starting date for all the jobs which started on or after 1st January, 1993 and ending with on or before 31 August, 1997.

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

Practice Online


HR database model

Query Visualization:

Duration:

Query visualization of Display the job title, department name, full name, and starting date for all the jobs which started on or after 1st January, 1993 and ending with on or before 31 August, 1997 - Duration

Rows:

Query visualization of Display the job title, department name, full name, and starting date for all the jobs which started on or after 1st January, 1993 and ending with on or before 31 August, 1997 - Rows

Cost:

Query visualization of Display the job title, department name, full name, and starting date for all the jobs which started on or after 1st January, 1993 and ending with on or before 31 August, 1997 - Cost

Have another way to solve this solution? Contribute your code (and comments) through Disqus.

Previous: Write a query in SQL to display the first name, last name, and department number for those employees who work in the same department as the employee who hold the last name as Taylor.
Next: Write a query in SQL to display job title, full name (first and last name ) of employee, and the difference between maximum salary for the job and salary of the employee.

What is the difficulty level of this exercise?



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