here are a couple of SQL examples, test your skills.
back ground:
Select count(1) from CRPDTA.F03B14;
>20467464 rows
select count(1) from CRPDTA.F03B14 WHERE rzpost <> ‘D’
>0 rows
select count(1) from CRPDTA.F03B14 WHERE RZPOST = ‘D’
>2767142 rows
So, do you see the problem? 2.7 million rows are ‘D’, 0 are not ‘D’, yet there are 18 millions rows not accounted for!
These rows ARE NULL!
So, what would I get with:
select count(1) from CRPDTA.F03B14 where RZPOST = NULL ?
>0 rows
WTF??? 0, I thought I’d get 18000000. Well, here is another idiosyncrasy of oracle SQL:
select count(1) from CRPDTA.F03B14 where RZPOST IS NULL;
>17709320 rows
No comments:
Post a Comment