
SQL SORTING and FILTERING on HR Database: Display job ID for those jobs that were done by two or more for more than 300 days
SQL SORTING and FILTERING on HR Database: Exercise-24 with Solution
24. Write a query in SQL to display job ID for those jobs that were done by two or more for more than 300 days.
Sample table : job_history
Sample Solution:
SELECT job_id
FROM job_history
WHERE end_date-start_date >300
GROUP BY job_id
HAVING COUNT(*)>=2;
Sample Output:
job_id ------------ AC_ACCOUNT ST_CLERK (2 rows)
Practice Online

Query Visualization:
Duration:

Rows:

Cost:

Contribute your code and comments through Disqus.
Previous: Write a query in SQL to display job ID, number of employees, sum of salary, and difference between highest salary and lowest salary for a job.
Next: Write a query in SQL to display the country ID and number of cities in that country we have.
What is the difficulty level of this exercise?
New Content: Composer: Dependency manager for PHP, R Programming