Oracle Tutorial

What is Oracle
SQL Keywords

Oracle Wildcards

Oracle Wildcards

Oracle Aliases

Oracle Aliases

MySQL Tutorial

MySQL Tutorial

PL/SQL Tutorial

PL/SQL Tutorial

Oracle Interview Questions

Oracle Interview Questions and Answers


Oracle Not Operator

In Oracle NOT operator is used to negate a condition in a SELECT, INSERT, UPDATE or DELETE statement. In other words, Oracle NOT condition is opposite of Oracle IN condition, it is fetch a record if the condition(s) is NOT TRUE.

Oracle NOT OPERATOR Syntax

To reduce the use of multiple OR conditions, use the following syntax:

Syntax

SELECT col1, col2, ...
FROM tablename
WHERE NOT condition;

Parameters:

tablename: The table name from which you want to perform NOT operator.

condition: Specifies the conditions that you want to negate.

Oracle NOT OPERATOR example

The following Oracle, NOT operator is used to fetch a records if the condition(s) is NOT TRUE:

Example

SELECT firstName, lastName, address 
FROM tblCustomerLoan
WHERE NOT firstName = 'Dilip';

Note:

In the above example, we are performing NOT operator to fetch a records if the condition(s) is NOT TRUE.

Oracle NOT OPERATOR example with IN operator

The following Oracle, NOT operator is used with IN operator to fetch a records if the condition(s) is NOT TRUE, then the IN operator will evaluate to true:

Example

SELECT firstName, lastName, address 
FROM tblCustomerLoan
WHERE firstName NOT IN ('Yogesh', 'Mahesh');

Note:

In the above example, we are performing NOT operator with IN operator to fetch a records if the condition(s) is NOT TRUE.