The Logical OR Operator in Oracle helps to join Boolean expressions and returns TRUE if minimum one condition returns TRUE.
Syntax
Condition1 OR Condition2;
Follow the Table to understand the concept better:
CONDITION_1 | CONDITION_2 | CONDITION_1 OR CONDITION_2 |
True | True | TRUE |
True | False | TRUE |
False | True | TRUE |
False | False | FALSE |
Example
We have a Stu Table as follows:
NOTE: Table Stu has 2 entries with the name Radha. However, Roll_no is different in both entries.
Follow the Code for OR Operator on Stu table:
select * from Stu where Name='Radha' OR Roll_no='180';
1) We need to find the values where name is Radha.
2) And also the values with 180 as a Roll_no.
It will function as:
Also, we all know that Logical OR Operator that have have either condition TRUE.
Output
NOTE: All the values that returns even a single TRUE is displayed in Output.