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:
WHERE column_name IN (value1, value2, ..., valueN)
Usage
##Subquery: WHERE IN You can use a subquery to get a list of values. For example:
WHERE id IN (SELECT id FROM other_table)
Multiple values: WHERE IN can check multiple values. For example:
WHERE name IN ('John', 'Mary', 'Bob')
NULL value: WHERE IN can check for NULL value. For example:
WHERE age IN (25, 30, NULL)
Example
The following query returns departments with a specific id:SELECT * FROM departments
WHERE id IN (10, 20, 30)
SELECT * FROM employees
WHERE name IN ('John', 'Mary', 'Bob')
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!