w3resource
SQL exercises

SQL SORTING and FILTERING on HR Database: Display the details of the employees who have no commission percentage and salary between 7000 to 12000 and works in department 50

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

33. Write a query in SQL to display the details of the employees who have no commission percentage and salary within the range 7000 to 12000 and works in that department which number is 50.

Sample table : employees


Sample Solution:

SELECT * 
	FROM employees 
		WHERE commission_pct IS NULL 
			AND salary BETWEEN 7000 AND 12000 
				AND department_id=50;

Sample Output:

employee_id | first_name | last_name | email | phone_number | hire_date | job_id | salary | commission_pct | manager_id | department_id
-------------+------------+-----------+-------+--------------+-----------+--------+--------+----------------+------------+-------------
(0 rows)

Practice Online


N.B.: In certain instances not null is removed in table structure, so results may vary.

HR database model

Query Visualization:

Duration:

Query visualization of Display the details of the employees who have no commission percentage and salary between 7000 to 12000 and works in department 50 - Duration

Rows:

Query visualization of Display the details of the employees who have no commission percentage and salary between 7000 to 12000 and works in department 50 - Rows

Cost:

Query visualization of Display the details of the employees who have no commission percentage and salary between 7000 to 12000 and works in department 50 - Cost

Contribute your code and comments through Disqus.

Previous: Write a query in SQL to display the employee ID and the date on which he ended his previous job.
Next: Write a query in SQL to display the job ID for those jobs which average salary is above 8000.

What is the difficulty level of this exercise?



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