Home » SQL Basics » Retrieving Data » Using IN

Using IN

Using IN

SELECT “column_name1”, “column_name2″,….”column_nameZ” FROM “table_name”
WHERE “column_name” IN (‘value1’, ‘value2’, …)

SELECT name, age FROM employee where name in (‘John’, ‘Smith’);

In the above example it only displays the records related to employees whose name is either ‘John’ or ‘Smith’.

Leave a Reply

Your email address will not be published.