Please note, this is a STATIC archive of website www.w3resource.com from 19 Jul 2022, cach3.com does not collect or store any user information, there is no "phishing" involved.
w3resource

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 Expression: 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.

Relational Algebra Tree:

Relational Algebra Tree: 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.

Practice SQLite Online


Model Database

Employee Model  Database - w3resource online SQLite practice

Structure of 'hr' database :

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?