Oracle – Logical Conditions

Logical Conditions

admin Condition, Oracle , , , ,

Hey time travellers,
In this article, we will be discussing Logical Conditions. It is a very important aspect of SQL. It helps us to combine the results of two component conditions to produce a single result. In simple words we can say, it helps us to apply multiple conditions on different fields/operands.

There are 3 types of Logical Conditions in SQL.

1.  AND:
When we use AND logical condition between two conditions, it returns TRUE if both component conditions are TRUE. It returns FALSE if either condition is FALSE.


In the above SQL query, there are two component conditions and AND logical condition has been placed between them. The SQL query will show results if there are some employees with job_id as ‘PU_CLERK’ and department_id as 30. If any of these conditions evaluate to be FALSE, the query will show no results.

2.  OR:
When we use OR logical condition between two component conditions, it returns TRUE if either component condition is TRUE. It returns FALSE if both conditions are FALSE.


In the above SQL query, two conditions are bound with OR logical condition. So this query will show more records than the query in the example-1. It will show all the employees with department ID 30 or who have job ID as ‘PU_CLERK’.

An OR logical condition produces more row than an AND logical condition does.
In the above two queries, logical conditions are used between two component conditions but we can also use them among more than two component conditions.

3.  NOT:
It always shows inverse results. If the following condition is TRUE, it returns FALSE and if the condition is FALSE, it returns TRUE. It is always used with other conditions like BETWEEN, EXISTS, IN etc.


Query-1 and Query-2 show its applications with the NULL condition and BETWEEN condition respectively.

If you have any questions/suggestions, please comment below or write me an email.
If you like this blog, do share with your friends and colleagues on your social media. For more updates join my Facebook group and do like my Facebook page.

Thank you,
Kapil Kumar

Sharing is caring!

You May Also Like..


Parentheses in SQL

Hey time travellers, Though Parentheses are used pretty much everywhere in SQL but in this blog, we will talk about […]


Oracle – IN Condition

Hey people, In this Oracle tutorial, we will learn how to use IN condition in SQL. IN condition is used […]


Oracle SQL_Null Related functions-3_NULLIF

Hi Aliens, Today, we will talk about another Null Related Function, NULLIF. You can read my notes on NVL, NVL2 […]

Leave a Reply

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