OR

SQL OR Keyword

The OR operator is used in a WHERE clause to filter records where at least one of the given conditions is true.

Tutorials dojo strip

SQL OR Syntax

SELECT column1, column2, ...
FROM table_name
WHERE condition1 OR condition2;

SQL OR with Patients Table Example

This query selects all patients whose gender is either ‘F'(Female)or whose last name is ‘Garcia’.

SELECT *
FROM Patients
WHERE gender = 'F' OR last_name = 'Garcia';

SQL OR with Appointments Table Example

This query selects all appointments scheduled either on ‘2023-11-15’ or with doctor_id equal to 2.

SELECT *
FROM Appointments
WHERE appointment_date = '2023-11-15' OR doctor_id = 2;

SQL OR Labs

Tutorials dojo strip
Scroll to Top