Chapter 12: Logical Operators
SQL Tutorial - Logical AND Operator
The Logical AND operator:
Logical Operator AND
Returns ‘True’ if both component conditions are true. Returns ‘False’ if any one component
condition or Both Component conditions are False.
Example:-
Display the details of Employees whose salary is Greater than 1000 AND also whose salary is
less than 2000.
SQL> SELECT *FROM emp WHERE sal > 1000 AND sal <2000;
SQL Tutorial - Logical OR Operator
The Logical OR operator:
Returns True if either component conditions become TRUE. Returns False if both the component
conditions becomes False.
Example:
Display the details of Employees whose salary is Greater than 1000 OR also whose salary is less
than 2000.
SQL> SELECT *FROM emp WHERE sal> 1000 OR sal < 2000;
SQL Tutorial - Logical NOT Operator
The Logical NOT operator:
The NOT operator returns ‘True’ if the condition is False and returns ‘False’ if the following
condition is True.
Example:
Display the details of employees whose salary is Greater than or Equals to 3000.
SQL> SELECT * FROM emp WHERE sal < 3000;