Difference: 1. in makes a hash connection between the parent query table and the sub-query table, while or performs a loop on the parent query table and then queries the sub-query table; 2. Data without an index The larger the amount, the execution efficiency of in will not drop much, while the execution efficiency of or will drop significantly.
The operating environment of this tutorial: Windows 10 system, Oracle 11g version, Dell G3 computer.
a in (1,2,3)(a = 1 or a = 2 or a = 3)
a = 1 && b = 2 or a = 3 is equivalent to the union of the conditions of (a = 1 && b =2) and a = 3
or, or if one of the two conditions is met
in is used to include, for example, select * from table in (a statement or several values)
or: satisfy at most two conditions in: satisfy more conditions
The operations are different
1. in: in is a hash connection between the parent query table and the child query table.
2. or: or performs a loop on the parent query table, and queries the child query table each time the loop loops.
Suitable for different
1. in: in is suitable for situations where the child query table has more data than the parent query table.
2. or: or is suitable for situations where the child query table has less data than the parent query table.
Different execution efficiency
1. In: In the absence of an index, as the amount of data behind in increases, the execution efficiency of in will decrease. There will be too big a drop.
2. or: In the absence of an index, as the amount of data behind or increases, the execution efficiency of or will decrease significantly.
Recommended tutorial: "Oracle Video Tutorial"
The above is the detailed content of What is the difference between in and or in oracle?. For more information, please follow other related articles on the PHP Chinese website!