SQL WHERE AND & OR multiple conditions
The SQL AND & OR operators are used to combine multiple conditions to narrow data in an SQL statement. These two operators are called as the conjunctive operators.
The SQL AND condition and OR condition can be combined to test for multiple conditions in a SELECT, INSERT, UPDATE, or DELETE statement.
The AND Operator - how to create - example
The basic syntax of the AND operator with WHERE is as −
WHERE [condition1] AND [condition2]...AND [conditionN];
Following is an example, which would fetch the ID, Surname and Fees fields from the USERS table, where the Fee is greater than 2525 AND the age is less than 30 years −
WHERE Fee > 2525 AND age <30;
The OR Operator - Example - How to create
The OR operator is used to combine multiple conditions in an SQL statement's WHERE clause.
WHERE [condition1] OR [condition2]...OR [conditionN]
Following is an example, which would fetch the ID, Surname and Fees fields from the USERS table, where the Fee is greater than 2525 OR the age is less than 30 years −
WHERE Fee > 2525 OR age <30;
Syntax The syntax for the AND condition and OR condition together in SQL is:
WHERE condition1 AND condition2 ... OR condition_n;
sql where and or SQL WHERE AND & OR multiple conditions - sql tutorial
690. MySQL Tutorial - w3resource
2576. SQL INSERT INTO - SQL Tutorial
2564. SQL AND & OR - SQL Tutorial
2570. SQL DELETE - SQL Tutorial
363. SQL Tutorial
3228. SQL - Syntax, sql tutorial
SQL - Syntax sql tutorial