Predict AND OR Logic
Predict Output Medium
Question
Rows: (x=1,y=2), (x=1,y=3), (x=2,y=2), (x=2,y=3). How many match x=1 OR y=2?
Code
SELECT COUNT(*) FROM t WHERE x = 1 OR y = 2;
Hint
OR matches if either condition is true.
Explanation
x=1 OR y=2 matches: (1,2)✓, (1,3)✓, (2,2)✓, (2,3)✗. Three rows match.
Related Resources
Related Lessons
- WHERE Clause
Learn AND/OR.
Look up unfamiliar terms
A beginner-friendly glossary explains jargon in plain English — variables, functions, DOM, Promise, and more.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.
Build real projects
Apply what you learned by building guided projects with starter code and solutions.