How to match strings in a DB2 query (z / OS)?

It blows my mind.

All I want to do is compare the main lines in a long field varchar.

I have a table approx. 12M records.

If I request MY_FIELD='a string', I get a score of 25947, which seems correct.

If I request MY_FIELD!='a string', I get a score of 989.

Aren't these two accounts summed up to the full size of table 12M?

+3
source share
1 answer

And how many of these lines are MY_FIELDset to NULL?

a. select count(*) from mytable;
b. select count(*) from mytable where my_field is null;
c. select count(*) from mytable where my_field is not null;
d. select count(*) from mytable where my_field = 'some value';
e. select count(*) from mytable where my_field != 'some value';

NULLnot equal to or not equal to any value, including NULL, so I would expect it to be d+eequated to cand b+cfor designation a.

+6

Source: https://habr.com/ru/post/1772853/


All Articles