Home » SQL Basics » Retrieving Data » Using IN

Using IN

Using IN

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

Example: 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. Required fields are marked *