Filtering with OR

The OR operator is used to filter data when at least one of multiple conditions is true.

Unlike AND, where all conditions must be true, OR returns rows if any condition is true.

Syntax

SELECT column1, column2
FROM table_name
WHERE condition1 OR condition2;

Example Finding students in the Computer Science OR Mathematics department:

SELECT * 
FROM Students
WHERE Department = 'Computer Science' OR Department = 'Mathematics';

Question number:

Up Next: Practice filtering with NOT

Donate

About

Privacy Policy

Changelog