Home > Database > SQL > What is the usage of in in sql

What is the usage of in in sql

爱喝马黛茶的安东尼
Release: 2020-01-07 15:02:51
Original
54026 people have browsed it

What is the usage of in in sql

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,...)
Copy after login

Original table (used in the example:)

Persons table:

What is the usage of in in sql

IN Operator Example

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

We can use the following SELECT statement:

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

Result set:

What is the usage of in in sql

PHP Chinese website has a large number of free SQL tutorials, everyone is welcome to learn!

The above is the detailed content of What is the usage of in in sql. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template