Skip to main content
SQL โ€ข LESSON 52

AND with OR

How can we combine AND and OR conditions to build more precise filters?

Intermediateโฑ 3 Minutesโญ 650 XP
๐Ÿค” THE QUESTION

How can we combine AND and OR conditions to build more precise filters?

๐Ÿ’ก WHAT IS IT?

Parentheses group logical expressions to enforce correct operator precedence when combining AND and OR logic.

๐ŸŽฏ WHAT IS IT USED FOR?

Multi-department threshold queries, composite eligibility rules, complex audit criteria.

๐Ÿ’ป EXAMPLE
SELECT name, department, salary
FROM employees
WHERE (department = 'Engineering' AND salary > 90000)
OR (department = 'Analytics' AND salary > 85000);

๐ŸŽฏ Mission Objectives

Practice typing production-grade SQL code for AND with OR.

  • โœ“ Precedence parentheses
  • โœ“ AND/OR combination
  • โœ“ Complex logic
  • โœ“ Grouping conditions