SQL Keyword - OR

OR Keyword

The OR keyword/operator is used with the where clause when we want to check multiple conditions and want any of them to be true.

The OR operators are used to filter records based on more than one condition and need any of the conditions to be true.

Syntax

SELECT <COLUMNS> FROM <TABLE_NAME> WHERE <CONDITION_1> OR <CONDITION_2>
DELETE FROM <TABLE_NAME> WHERE <CONDITION_1> OR <CONDITION_2>
UPDATE <TABLE_NAME> SET <COLUMN_NAME> = <VALUE> WHERE <CONDITION_1> OR <CONDITION_2>

Example

SELECT * FROM Employee WHERE Emp_Salary > 50000 OR Emp_Dept = 'Accounts'
DELETE FROM Employee WHERE Emp_Salary > 50000 OR Emp_Dept = 'Accounts'
UPDATE Employee  SET Emp_Salary = Emp_Salary + 5000 WHERE Emp_Salary > 50000 OR Emp_Dept = 'Accounts'

Summary

The OR keyword is used when we want to check more than one condition and also whether any of them is true.

Next Recommended Reading SQL Keyword - ALL