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 |
|---|---|---|
| True | True | ✅ Included |
| True | False | ✅ Included |
| False | True | ✅ Included |
| False | False | ❌ Excluded |
At least one must be true!
Multiple ORs
sql
1SELECT * FROM students
2WHERE course = 'Python'
3OR course = 'JavaScript'
4OR course = 'Ruby';