w3resource

SQL SORTING and FILTERING on HR Database: Display the full name, and salary for all employees who does not earn any commission

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

8. From the following table, write a SQL query to find those employees who do not earn any commission.Return full name (first and last name), and salary.

Sample table : employees


Sample Solution:

SELECT first_name ||' '||last_name AS Full_Name, salary
 FROM  employees
  WHERE commission_pct IS NULL;

Sample Output:

 full_name | salary
-----------+--------
(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 full name, and salary for all employees who does not earn any commission - Duration

Rows:

Query visualization of Display the full name, and salary for all employees who does not earn any commission - Rows

Cost:

Query visualization of Display the full name, and salary for all employees who does not earn any commission - Cost

Contribute your code and comments through Disqus.

Previous: From the following table, write a SQL query to find those employees whose salary is in the range of 8000, 12000 (Begin and end values are included.) and get some commission. These employees have joined before ‘1987-06-05’ and not included in the department number 40, 120 and 70. Return all fields.
Next: From the following table, write a SQL query to find those employees whose salary is in the range 9000,17000 (Begin and end values are included). Return full name, contact details and salary.

What is the difficulty level of this exercise?

Test your Programming skills with w3resource's quiz.



SQL: Tips of the Day

MySQL export schema without data

mysqldump -h yourhostnameorIP -u root -p --no-data dbname > schema.sql

Ref: https://bit.ly/3xzB9dS