SQL OR
The OR
operator in SQL is used to combine multiple conditions in a WHERE
clause. It ensures that if any of the conditions is true, the record will be included in the result set.
Syntax
SELECT column1, column2, ...
FROM table_name
WHERE condition1 OR condition2 OR ...;
- condition1, condition2, ... – Specifies the conditions where if any of them are true, the record will be selected.
Example
SELECT Name, Age, Salary
FROM Employees
WHERE Age < 25 OR Salary > 60000;
In this example:
- The query selects records from the Employees table where either condition is true: the Age is less than 25 or the Salary is greater than 60,000.