What exactly is the difference between 'in' and 'like '.

Hello

I wrote the following query, which according to me is the same, but it does not give the same result!

select * from OE.PRODUCT_INFORMATION where product_name in ('HD%','GP%');
select * from OE.PRODUCT_INFORMATION where product_name like 'HD%' or product_name like 'GP%';

So when I write IN it should always select any start of product with right to HD or GP? but this does not happen and no results are returned when I run with OPERATOR

Technically the two should give the same just result?

Please guide me here.

SQL lover wrote:

I wrote the following query, which according to me is the same, but it does not give the same result!

  1. Select * from OE. PRODUCT_INFORMATION where product_name in ('% HD', 'GP');
  2. Select * from OE. PRODUCT_INFORMATION where product_name as 'HD %' or product_name like '% GP. "

So when I write IN it should always select any start of product with right to HD or GP?

N °

but this does not happen and no results are returned when I run with OPERATOR

Technically the two should give the same just result?

N °

Wildcards can only be used with the LIKE operator.

Tags: Database

Similar Questions

Maybe you are looking for