The WHERE IN clause is used in Oracle to check whether the column value is in a specific value list: Syntax: WHERE column_name IN (value1, value2, ..., valueN) Subquery: WHERE IN subquery can be used Query to get a list of values. Multiple values: WHERE IN checks for multiple values. NULL values: WHERE IN checks for NULL values. Example: Query departments with id 10, 20 or 30 SELECT * FROM departments WHERE id IN (10, 20, 30)
WHERE in Oracle IN Usage
WHERE IN clause is used to check whether the value of a column is in the specified list of values. The syntax is:
<code>WHERE column_name IN (value1, value2, ..., valueN)</code>
Usage
##Subquery: WHERE IN You can use a subquery to get a list of values. For example:
<code>WHERE id IN (SELECT id FROM other_table)</code>
Multiple values: WHERE IN can check multiple values. For example:
<code>WHERE name IN ('John', 'Mary', 'Bob')</code>
NULL value: WHERE IN can check for NULL value. For example:
<code>WHERE age IN (25, 30, NULL)</code>
Example
The following query returns departments with a specific id:<code>SELECT * FROM departments WHERE id IN (10, 20, 30)</code>The following query returns departments with a specific name Employee:
<code>SELECT * FROM employees WHERE name IN ('John', 'Mary', 'Bob')</code>
Notes
The above is the detailed content of How to use where in in oracle. For more information, please follow other related articles on the PHP Chinese website!