SQLite Exercise: Display the names and salary for all employees whose salary is not in the specified range
Write a query to display the names (first_name, last_name) and salary for all employees whose salary is not in the range $10,000 through $15,000.
Sample table : employees
SQLite Code :
SELECT first_name, last_name, salary
FROM employees
WHERE salary NOT BETWEEN 10000 AND 15000;
Output:
first_name last_name salary ---------- ---------- ---------- Steven King 24000 Neena Kochhar 17000 Lex De Haan 17000 Alexander Hunold 9000 Bruce Ernst 6000 David Austin 4800 Valli Pataballa 4800 Diana Lorentz 4200 Daniel Faviet 9000 John Chen 8200 Ismael Sciarra 7700 Jose Manue Urman 7800 Luis Popp 6900 Alexander Khoo 3100 Shelli Baida 2900 Sigal Tobias 2800 Guy Himuro 2600 Karen Colmenares 2500 Matthew Weiss 8000 Adam Fripp 8200 Payam Kaufling 7900 Shanta Vollman 6500 Kevin Mourgos 5800 Julia Nayer 3200 Irene Mikkilinen 2700 James Landry 2400 Steven Markle 2200 Laura Bissot 3300 Mozhe Atkinson 2800 James Marlow 2500 TJ Olson 2100 Jason Mallin 3300 Michael Rogers 2900 Ki Gee 2400 Hazel Philtanker 2200 Renske Ladwig 3600 Stephen Stiles 3200 John Seo 2700 Joshua Patel 2500 Trenna Rajs 3500 Curtis Davies 3100 Randall Matos 2600 Peter Vargas 2500 David Bernstein 9500 Peter Hall 9000 Christophe Olsen 8000 Nanette Cambrault 7500 Oliver Tuvault 7000 Patrick Sully 9500 Allan McEwen 9000 Lindsey Smith 8000 Louise Doran 7500 Sarath Sewall 7000 Danielle Greene 9500 Mattea Marvins 7200 David Lee 6800 Sundar Ande 6400 Amit Banda 6200 Tayler Fox 9600 William Smith 7400 Elizabeth Bates 7300 Sundita Kumar 6100 Alyssa Hutton 8800 Jonathon Taylor 8600 Jack Livingston 8400 Kimberely Grant 7000 Charles Johnson 6200 Winston Taylor 3200 Jean Fleaur 3100 Martha Sullivan 2500 Girard Geoni 2800 Nandita Sarchand 4200 Alexis Bull 4100 Julia Dellinger 3400 Anthony Cabrio 3000 Kelly Chung 3800 Jennifer Dilly 3600 Timothy Gates 2900 Randall Perkins 2500 Sarah Bell 4000 Britney Everett 3900 Samuel McCain 3200 Vance Jones 2800 Alana Walsh 3100 Kevin Feeney 3000 Donald OConnell 2600 Douglas Grant 2600 Jennifer Whalen 4400 Pat Fay 6000 Susan Mavris 6500 William Gietz 8300
Relational Algebra Expression:

Relational Algebra Tree:

Practice SQLite Online
Model Database
Structure of 'hr' database :

Improve this sample solution and post your code through Disqus.
Previous: Simple select statements
Next: Write a query to display the names (first_name, last_name) and department ID of all employees in departments 30 or 100 in ascending alphabetical order by department ID.
What is the difficulty level of this exercise?
- Weekly Trends
- Python Interview Questions and Answers: Comprehensive Guide
- Scala Exercises, Practice, Solution
- Kotlin Exercises practice with solution
- MongoDB Exercises, Practice, Solution
- SQL Exercises, Practice, Solution - JOINS
- Java Basic Programming Exercises
- SQL Subqueries
- Adventureworks Database Exercises
- C# Sharp Basic Exercises
- SQL COUNT() with distinct
- JavaScript String Exercises
- JavaScript HTML Form Validation
- Java Collection Exercises
- SQL COUNT() function
- SQL Inner Join