Page 1 of 1

DB2 question with LIKE concept

Posted: Wed Apr 22, 2015 6:35 pm
by Gurugars
Dear friends,

I was wondering how LIKE clause will behave in the following scenario.

I have a query where I'm using LIKE clause as follows,

Code: Select all

SELECT COL-1, COL-2, COL-3
   FROM TABLE1
WHERE COL-1 LIKE 'ABC%'
Here assume that the COL-1 is of size 4 CHAR. In the above case I believe the entire table will be scanned as I've used LIKE clause (assume COL-1 is not indexed).

Now, If I'm checking exactly the same length data against the LIKE clause, will it behave like EQUAL condition check.

Code: Select all

SELECT COL-1, COL-2, COL-3
   FROM TABLE1
WHERE COL-1 LIKE 'ABCD'
Here there is no patern checking, so will it behave like COL-1 = 'ABCD'.?

I've tried this myself as I don;t have much data in our tables, I couldn't see the difference.

Please let me know if the above scenario is not clear.


Thanks in advance.

Posted: Mon Apr 27, 2015 6:00 pm
by dbzTHEdinosauer
have you looked at the EXPLAIN output for these queries?

Topic deleted by Admin

Posted: Fri Jan 15, 2016 8:49 pm
by academyindia4
<< Content deleted By Admin >>