How to use in in sql
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!