SQL / MySQL Beginner Database · 1 min read

WHERE with AND / OR

Start the SQL / MySQL learning path »

❮ SQL / MySQL Home All Tutorials ❯

How do I combine filters in SQL?

AND / OR precedence.

Example

SQL / MySQL Example
SELECT id, name, year_level
FROM students
WHERE year_level = 1
  AND (course = 'web1' OR course = 'web2')
ORDER BY name;

Line-by-Line Walkthrough

Use parentheses when mixing AND and OR.

Need more coins?

You do not have enough coins for this action.

Your balance: 0 coins

Share

Reactions

Loading reactions…