SQL Or

The SQL Or clause is used to filter records where at least one of the conditions specified is true. Unlike […]

The SQL Or clause is used to filter records where at least one of the conditions specified is true. Unlike the AND clause, which requires all conditions to be met, the OR clause allows for flexibility by including records that meet any of the given conditions.

SQL Or Syntax

SQL



Tutorials dojo strip

SQL Or Example

SQL Or Basic OR Usage Example

This query retrieves the first_name, last_name, and specialty columns from the DOCTORS table for doctors whose specialty is either ‘Cardiology’ or ‘Neurology’.

SQL



SQL Or Using OR with Multiple conditions Example

This query retrieves the first_name, last_name, dob (date of birth), and gender columns from the PATIENTS table. It includes all female patients (gender = ‘F’) and patients who were born before January 1, 1985 (dob < ‘1985-01-01).

SQL




SQL Or Combining OR with AND

This query selects the first_name, last_name, contact_number, and dob (date of birth) columns from the PATIENTS table. It filters the results based on gender (gender = ‘M’), contact_number is not NULL, and dob (date of birth) must be later than January 1, 1990 (dob > ‘1990-01-01’).

SQL




SQL Or Visual Diagram




SQL Or Labs

Tutorials dojo strip