/    /  MySQL – AND OR

MySQL – AND OR

 

MySQL - AND OR

In MySQL, you can use AND and OR conditions in conjunction with SELECT, INSERT, UPDATE, and DELETE statements. If you combine these conditions, you must include brackets to indicate to the database the order in which each condition should be evaluated.

Syntax:

WHERE condition1  
AND condition2  
...  
OR condition_n;

condition1, condition2, … condition_n – The conditions that determine whether the records will be selected are described in this document.

Example

SELECT *  
FROM employees  
WHERE (last_name = 'Sluis' AND hire_date = '1990-01-22')  
OR (emp_no < 0);

MySQL - AND OR