I ran into a snag on the SUM() section, especially the statement "we can rest assured that NULLs are eliminated from our result"
I tried to use SUM() as suggested but it returns NULLS.
I then tried to use a CASE statement like this (but it failed to eliminate NULLS as well):
SELECT SUM(CASE WHEN someField IS NULL THEN 0) AS SumOfSomeField FROM someTable
To get it to work I needed to change the CASE logic like this:
SELECT SUM(CASE WHEN someField IS NOT NULL THEN someField ELSE 0) AS SumOfSomeField FROM someTable
I can't understand why T-SQL behaves this way. But then again it is a Microsoft product so I'm not surprised