SELECT LASTNAME, FIRSTNAME, ADDR1 FROM EMP SELECT LASTNAME, FIRSTNAME, ADDR1 FROM EMP WHERE 1 = 1Is there any difference in the treatment of the optimizer for the above two queries?
I've never seen an approach like this before. Perhaps you are confusing this with the approach of appending OR...
0 = 1 to a predicate to force DB2's hand when selecting an index at bind time. For example, consider this statement:
SELECT a,b,c FROM table1 WHERE d between 'A' and 'F' AND e > 1500;
SELECT a,b,c FROM table1 WHERE d between 'A' and 'F' AND (e > 1500 OR 0 = 1);
Dig Deeper on IBM DB2 management
Related Q&A from Craig S. Mullins
To export data from a DB2 table to a flat file, you need to run an export specifying the proper file format. The export utility exports data from a ... Continue Reading
Craig Mullins recommends two specific resources for learning how to create and support Binary Large Objects (BLOB) in DB2. Continue Reading
Craig Mullins explains various definitions of a data mart and sheds some light on the complexity of its relation to a data warehouse. Continue Reading