| by Arround The Web | No comments

SQL LIKE Operator

“In this tutorial, you will learn how to use the LIKE operator in Standard SQL, which allows you to check if a value is in a given set of values.”

SQL IN Operator

The IN operator in SQL facilitates a quick search of a value in a given set without the need for complex computation. The function syntax is as shown:

expression IN (value1,value2,...);

The operator checks if the provided expression is located in the given values. If found, the operator returns TRUE; otherwise, it returns false.

In most cases, you will often pair the IN operator with other clauses, such as the WHERE clause. This can allow you only to fetch values matching a specific condition.

Let us discuss some basic examples of usage of the IN operator in SQL.

Example Usage

The following examples illustrate how to use the IN operator in SQL.

Example 1 – Basic Usage

The example below shows the basic usage of the IN operator.

SELECT 'SQL' IN ('SQL', 'Redis', 'Elasticsearch');

In the above example, we use the IN operator to check if the string “SQL” is in the given set of values.

Since the string exists, the query should return true, as shown:

Example 2 – Using IN Operator in Table

The following shows how to use the IN operator in conjunction with the WHERE clause in a table.

The table is as shown:

SELECT * FROM products WHERE 'Apple iPad Air - 2022' IN(product_name);

The query should return the matching records as:


This article shows how to use the IN operator in Standard SQL. The IN operator allows you to check if a given expression is in a set of values.

Share Button

Source: linuxhint.com

Leave a Reply