In Oracle, in in the sql statement is used to operate data within a certain range. The specified field value only needs to satisfy any one within this range. The syntax is "select * from table Name where field in (value1, value2,…);”.
The operating environment of this tutorial: Windows 10 system, Oracle version 12c, Dell G3 computer.
In Oracle, in is often used in where conditional expressions. It can operate on data whose field values meet the specified range. The syntax is " select * from table name where field in (value1, value2,…);”.
in is often used in conditional expressions (where). Its function is to operate, query or delete data within a certain range. The field value can be satisfied as long as it meets any one within this range
Query
select * from TableName(表名) where 字段 in (value1,value2,…); select * from TableName(表名) where 字段 not in (value1,value2,…); select 字段1,字段2,… from 表名 where 字段 in/not in (value1,value2,…);
Delete
delete from 表名 where 字段 in/not in (value1,value2,…);
The example is as follows:
in is used to query records
(1) Query all records in the t_hero table
(2) Query keyid equal to (21,16,7) This All records with one of the three values can be queried as long as they satisfy one of the three values.
(3) Query all records whose keyid is not in the range of (21,16,7).
(1) Query all records in the t_hero table, there are now 7 records
(2) Delete the two records with keyid = (14,15)
Recommended tutorial: "Oracle Video Tutorial"
The above is the detailed content of How to use in in oracle sql statement. For more information, please follow other related articles on the PHP Chinese website!