MySQL Wildcards

MySQL Wildcards

MySQL Aliases

MySQL Aliases

MySQL Data Types

MySQL Data Types

MySQL Interview Questions

MySQL Interview Questions and Answers


MySQL OR Operator

The MySQL OR operator is used to displays a record if any one of the condition is TRUE to get the records as result. In other hand, MySQL OR operator is filter record if any of the conditions separated by OR is TRUE.

MySQL OR OPERATOR Syntax

To filter a record if any of the conditions separated by OR is TRUE, use the following syntax:

Syntax

SELECT col1, col2, ...
FROM tablename
WHERE condition1 OR condition2 OR condition3 ...;  

Parameters:

tablename: The table name from which you want to fetch the records.

condition: To specifies multiple conditions, either of the condition must be true to select records.

MySQL OR OPERATOR example

The following MySQL statement is used to filter a record if any of the conditions separated by OR is TRUE:

Example

SELECT firstName, lastName, address FROM tblCustomerLoan 
WHERE cellNo = 7897897890 OR lastName = 'Singh';

Note:

In the above example, we are showing how to use the OR operator to filter records based on any of the conditions separated by OR is TRUE SELECT statement.

You can use MySQL Command Line Client to filter records based on any of the conditions separated by OR is TRUE. It will look like this: