w3resource
SQL exercises

SQL SORTING and FILTERING on HR Database: Display job Title, the difference of minimum and maximum salaries for those jobs which max salary between 12000 to 18000

SQL SORTING and FILTERING on HR Database: Exercise-35 with Solution

35. Write a query in SQL to display job Title, the difference between minimum and maximum salaries for those jobs which max salary within the range 12000 to 18000.

Sample table : jobs


Sample Solution:

SELECT job_title, max_salary-min_salary AS salary_differences 
	FROM jobs 
		WHERE max_salary BETWEEN 12000 AND 18000;

Sample Output:

      job_title       | salary_differences
----------------------+--------------------
 Finance Manager      |               7800
 Accounting Manager   |               7800
 Sales Representative |               6000
 Purchasing Manager   |               7000
 Marketing Manager    |               6000
(5 rows)

Practice Online


HR database model

Query Visualization:

Duration:

Query visualization of Display job Title, the difference of minimum and maximum salaries for those jobs which max salary between 12000 to 18000 - Duration

Rows:

Query visualization of Display job Title, the difference of minimum and maximum salaries for those jobs which max salary between 12000 to 18000 - Rows

Cost:

Query visualization of Display job Title, the difference of minimum and maximum salaries for those jobs which max salary between 12000 to 18000 - Cost

Contribute your code and comments through Disqus.

Previous: Write a query in SQL to display the job ID for those jobs which average salary is above 8000.
Next: Write a query in SQL to display all those employees whose first name or last name starts with the letter D.

What is the difficulty level of this exercise?



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