SQL IN Operator
You can specify multiple values with IN operator and it will return matching values from WHERE clause of a table. IN operator matches values in a list or subquery and returns the output. Here we will use STUDENT table for demonstration purpose.
Syntax
SELECT column1, column2,… columnN
FROM TableName
WHERE column IN (Value1, Value2,…ValueN);
Let’s take one example from student table where we will use IN operator to fetch records where FirstName are in Gigi, Dylan and Ken and we can see it has returned five rows as follows.
SELECT *FROM Student WHERE FirstName IN ('Gigi', 'Dylan', 'Ken')
CLICK HERE to watch live practical.
Reference: Manzoor Siddiqui [www.SQLServerLog.com]