SQLite Exercise: Display the last name, job, and salary for all employees whose job is that of a Programmer or a Shipping Clerk, and whose salary is not equal to $4,500, $10,000, or $15,000
Write a query to display the last name, job, and salary for all employees whose job is that of a Programmer or a Shipping Clerk, and whose salary is not equal to $4,500, $10,000, or $15,000.
Sample table : employees
SQLite Code :
SELECT last_name, job_id, salary
FROM employees
WHERE job_id IN ('IT_PROG', 'SH_CLERK')
AND salary NOT IN (4500,10000, 15000);
Output:
last_name job_id salary ---------- ---------- ---------- Hunold IT_PROG 9000 Ernst IT_PROG 6000 Austin IT_PROG 4800 Pataballa IT_PROG 4800 Lorentz IT_PROG 4200 Taylor SH_CLERK 3200 Fleaur SH_CLERK 3100 Sullivan SH_CLERK 2500 Geoni SH_CLERK 2800 Sarchand SH_CLERK 4200 Bull SH_CLERK 4100 Dellinger SH_CLERK 3400 Cabrio SH_CLERK 3000 Chung SH_CLERK 3800 Dilly SH_CLERK 3600 Gates SH_CLERK 2900 Perkins SH_CLERK 2500 Bell SH_CLERK 4000 Everett SH_CLERK 3900 McCain SH_CLERK 3200 Jones SH_CLERK 2800 Walsh SH_CLERK 3100 Feeney SH_CLERK 3000 OConnell SH_CLERK 2600 Grant SH_CLERK 2600
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: Write a query to display the first_name of all employees who have both an "b" and "c" in their first name.
Next: Write a query to display the last names of employees whose names have exactly 6 characters.
What is the difficulty level of this exercise?
- New Content published on w3resource:
- HTML-CSS Practical: Exercises, Practice, Solution
- Java Regular Expression: Exercises, Practice, Solution
- Scala Programming Exercises, Practice, Solution
- Python Itertools exercises
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework
- Angular - JavaScript Framework
- Vue - JavaScript Framework
- Jest - JavaScript Testing Framework