Oracle SQL Tutorials – Chapter 2 (Part 2 of 3)

IS NULL OPERATOR

  • Let’s list the employees that have manager.
SELECT first_name,last_name, manager_id
FROM hr.employees
WHERE manager_id IS not NULL;

 

LOGICAL OPERATORS

  • AND : It returns TRUE if all operands are TRUE.

 

  • OR : It returns TRUE if any operand is TRUE.

 

  • NOT : It returns the reverse of the result.

 

AND OPERATOR

  • Let’s list the employees that have salary 7000 or more and have ‘A’ character in his/her name.
SELECT employee_id, first_name,last_name, job_id, salary 
FROM hr.employees 
WHERE salary >= 7000 and first_name LIKE '%A%' ;

 

OR OPERATOR

  • Let’s list the employees that has 7000 or more salary; or have ‘A’ character in his/her name.
SELECT employee_id, first_name,last_name, job_id, salary 
FROM hr.employees 
WHERE salary >= 7000 
OR first_name LIKE '%A%' ;

 

NOT OPERATOR

  • Let’s list the employees that are don’t work at the IT_PROG , ST_CLERK or SA_REP.
SELECT first_name,last_name, job_id 
FROM hr.employees 
WHERE job_id NOT IN ('IT_PROG', 'ST_CLERK', 'SA_REP') ;

  • Let’s list the employees that don’t have ‘e’ character in his/her name.
SELECT first_name,last_name, job_id 
FROM hr.employees 
WHERE first_name NOT LIKE '%e%' ;

 

You can continue to read from this link ;

Oracle SQL Tutorials – Chapter 2 (Part 3 of 3)

 

About ismail tolga can

Leave a Reply

Your email address will not be published. Required fields are marked *