Skip
Arish's avatar

25. Combining Conditions with OR


The OR Operator

OR combines conditions where ANY can be true.

Syntax

sql
1SELECT * FROM students
2WHERE condition1 OR condition2;

Example

Find Python OR JavaScript students:

sql
1SELECT * FROM students
2WHERE course = 'Python'
3OR course = 'JavaScript';

How OR Works

course = 'Python'course = 'JavaScript'Result
TrueTrue✅ Included
TrueFalse✅ Included
FalseTrue✅ Included
FalseFalse❌ Excluded

At least one must be true!

Multiple ORs

sql
1SELECT * FROM students
2WHERE course = 'Python'
3OR course = 'JavaScript'
4OR course = 'Ruby';