What is Logical OR Operator in SQL Server - SQL Server / TSQL Tutorial Part 119

Logical Operators are used to test some conditions. If the condition is true, the row will be selected for output.

What is OR Logical Operator : 

OR logical operator is used when we want to return the row if at least one of the condition is true.

Scenario : 

Let's say that you have dbo.Customer table and you want to return all the rows if FName='Raza' Or CountryShortName='US'.

Create the dbo.Customer table by using below script.

Create table dbo.Customer
 (Id int,
  FName VARCHAR(50),
  LName VARCHAR(50),
  CountryShortName CHAR(2))
insert into dbo.Customer
Values (

We can use below query with OR Logical operator to return all rows where FName='Raza' Or CountryShortName='US'.

Select * From dbo.Customer
where FName='Raza'
OR CountryShortName='US'

As we have used OR logical operator in our query, the row will be returned if at-least one condition is true. We can see that for FName='Raza', the row is selected even second condition is not true.
Same goes for other three records which are returned even FName is not equal to 'Raza' but CountryShortName is equal to 'US' that makes one condition true.