Home  >  Article  >  Backend Development  >  How to use the SQL IN operator

How to use the SQL IN operator

jacklove
jackloveOriginal
2018-05-08 10:04:373408browse

SQL IN Operator is very important in phpdatabase operation. This article explains the relevant knowledge.

IN Operator

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

SQL IN Syntax

SELECT column_name(s)
FROM table_name
WHERE column_name IN (value1,value2,...)

IN Operator Example

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

We You can use the following SELECT statement:

SELECT * FROM Persons
WHERE LastName IN ('Adams','Carter')

This article provides a relevant explanation of the in operator. For more learning materials, please pay attention to the php Chinese website.

Related recommendations:

Explanation of SQL wildcard related knowledge

Explanation of SQL LIKE operator

Explanation on SQL TOP clause

The above is the detailed content of How to use the SQL IN operator. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn