w3resource
SQL exercises

SQL SORTING and FILTERING on HR Database: Display the full name, and salary for those employees who earn below 6000

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

1. Write a query in SQL to display the full name (first and last name), and salary for those employees who earn below 6000.

Sample table: employees


Sample Solution:

SELECT first_name ||' '||last_name AS Full_Name, salary
  FROM employees
    WHERE salary < 6000;

Sample Output:

     full_name     | salary
-------------------+---------
 David Austin      | 4800.00
 Valli Pataballa   | 4800.00
 Diana Lorentz     | 4200.00
 Alexander Khoo    | 3100.00
 Shelli Baida      | 2900.00
 Sigal Tobias      | 2800.00
 Guy Himuro        | 2600.00
 Karen Colmenares  | 2500.00
 Kevin Mourgos     | 5800.00
 Julia Nayer       | 3200.00
 Irene Mikkilineni | 2700.00
 James Landry      | 2400.00
 Steven Markle     | 2200.00
 Laura Bissot      | 3300.00
 Mozhe Atkinson    | 2800.00
 James Marlow      | 2500.00
 TJ Olson          | 2100.00
 Jason Mallin      | 3300.00
 Michael Rogers    | 2900.00
 Ki Gee            | 2400.00
 Hazel Philtanker  | 2200.00
 Renske Ladwig     | 3600.00
 Stephen Stiles    | 3200.00
 John Seo          | 2700.00
 Joshua Patel      | 2500.00
 Trenna Rajs       | 3500.00
 Curtis Davies     | 3100.00
 Randall Matos     | 2600.00
 Peter Vargas      | 2500.00
 Winston Taylor    | 3200.00
 Jean Fleaur       | 3100.00
 Martha Sullivan   | 2500.00
 Girard Geoni      | 2800.00
 Nandita Sarchand  | 4200.00
 Alexis Bull       | 4100.00
 Julia Dellinger   | 3400.00
 Anthony Cabrio    | 3000.00
 Kelly Chung       | 3800.00
 Jennifer Dilly    | 3600.00
 Timothy Gates     | 2900.00
 Randall Perkins   | 2500.00
 Sarah Bell        | 4000.00
 Britney Everett   | 3900.00
 Samuel McCain     | 3200.00
 Vance Jones       | 2800.00
 Alana Walsh       | 3100.00
 Kevin Feeney      | 3000.00
 Donald OConnell   | 2600.00
 Douglas Grant     | 2600.00
 Jennifer Whalen   | 4400.00
(50 rows)

Practice Online


HR database model

Query Visualization:

Duration:

Query visualization of Display the full name, and salary for those employees who earn below 6000 - Duration

Rows:

Query visualization of Display the full name, and salary for those employees who earn below 6000 - Rows

Cost:

Query visualization of Display the full name, and salary for those employees who earn below 6000 - Cost

Contribute your code and comments through Disqus.

Previous: SQL SORTING and FILTERING on HR Database Exercises Home
Next: Write a query in SQL to display the first and last_name, department number and salary for those employees who earn more than 8000.

What is the difficulty level of this exercise?



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