SQL -Structured Query Language - Sql Clause - Or Operator Tutorial
To use two or more conditions to retrieve, insert, update and delete records from the existing created table. And from this, anyone condition have to meet. Then we can use a ' WHERE ' statement with OR conditions.
Syntax-
The basic syntax of WHERE statement with OR conditions.–
SELECT * FROM table_name WHERE condition_1 OR condition_2;
In this anyone condition, condition_1 or condition_2 will be met.
For example –
SELECT * FROM employees WHERE first_name LIKE 'su%' OR employee_id>150;
In this statement, it will retrieve the first_name start with specific syntax “su” and also retrieve the record in which the employee_id is greater than 150 from the table employees.
In this, anyone, condition (name LIKE “s%”) or (age>30) will be met.
Note- OR Condition not only used in SELECT but also INSERT, UPDATE and DELETE.