What is IN Logical Operator :IN logical operator is used when we want to return the row if specified value matches with any value in the sub-query or a list.
The IN Logical operator is going to be true if the operand is equal to one of the list of expressions.
Let's say that we have dbo.Customer table with below rows. We want to return the rows where CountryShortName is equal to 'PK' OR 'US'.
Create table dbo.Customer
(Id int, FName VARCHAR(50), LName VARCHAR(50), CountryShortName CHAR(2)) GO insert into dbo.Customer Values ( 1,'Raza','M','PK'), (2,'Rita','John','US'), (3,'Sukhi','Singh',Null), (4,'James','Smith','CA'), (5,'Robert','Ladson','US'), (6,'Alice','John','US')
Let's write our query by using IN logical operator.
Select * From dbo.Customer
where CountryShortName IN ('US','PK')
|How to use IN Logical Operator in SQL Server - SQL Server / TSQL Tutorial|
Video Demo How to use IN Logical Operator in SQL Server