Tuesday , April 23 2024

IN Operator in SQL Server(TSQL)

 

When filtering through the Where Clause during data reading from the database, the IN operator can check whether the column is within certain values.

Let’s make an example for a better understanding of the subject.

First, we create a table as below and add a few records to the table.

Find people whose age is one of the values “25,26,27,28,29,30” :

We can write the same query above with a subquery in the IN operator:

Loading

About dbtut

We are a team with over 10 years of database management and BI experience. Our Expertises: Oracle, SQL Server, PostgreSQL, MySQL, MongoDB, Elasticsearch, Kibana, Grafana.

Leave a Reply

Your email address will not be published. Required fields are marked *

Categories