Get the App
SLTechnology News&Howtos  ›  Database  › 

How to use in in sql

Shulou Source: shulou.com Published: 2022-05-31 23:54:58 09月15日 Update

This article is about how to use in in sql. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

IN operator

The IN operator allows us to specify multiple values in the WHERE clause.

SQL IN syntax

SELECT column_name (s) FROM table_nameWHERE column_name IN (value1,value2,...)

The original table (used in the instance:)

Persons table:

IN operator instance

Now, we want to select people with last names Adams and Carter from the above table:

We can use the following SELECT statement:

SELECT * FROM PersonsWHERE LastName IN ('Adams','Carter')

Result set:

Thank you for reading! This is the end of the article on "how to use in in sql". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!

Tags: Operators content examples more articles good original practical above table multiple last names clauses articles look knowledge results statements grammar face reference Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno Microsoft Xiaomi Apple Huawei