Hello,
What is the difference between the following two SQL statements,
SELECT COUNT (*)
FROM products
WHERE t2 IN ('?', 'P?', 'P??')
and
SELECT COUNT (*)
FROM products
WHERE (t2 = '?' OR t2 = 'P?' OR t2 = 'P??')
Does the above two can be used interchangeably? or does the above two have pros and cons?
Appreciate any insight or help.
Table DDL and sample data
CREATE TABLE products
(
t1 NUMBER,
t2 VARCHAR2 (32)
);
SET DEFINE OFF;
Insert into PRODUCTS
(T1, T2)
Values
(110, '?');
Insert into PRODUCTS
(T1, T2)
Values
(110, 'P?');
Insert into PRODUCTS
(T1, T2)
Values
(110, 'P??');
Insert into PRODUCTS
(T1, T2)
Values
(220, '?');
Insert into PRODUCTS
(T1, T2)
Values
(220, 'P?');
Insert into PRODUCTS
(T1, T2)
Values
(220, 'P??');
COMMIT;