Q
Problem solve Get help with specific problems with your technologies, process and projects.

Does SUM discard rows that have 0 values?

Does SUM discard rows that have 0 values if it is applied to a column in a table?

Does SUM discard rows that have 0 values if it is applied to a column in a table? For example,

SELECT SUM(CREDIT_HRS)... FROM tablename

No. The SUM function, as well as all other aggregate functions, includes all non-NULL values, and zero is non-NULL. NULLs are ignored, but NULLs are not the same as zeroes.

But when you stop and think about it, what would the difference to the final answer be if zeroes were excluded, as compared to included? Would the answer be any different?

This was last published in May 2007

Dig Deeper on Oracle and SQL

PRO+

Content

Find more PRO+ content and other member only offers, here.

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

-ADS BY GOOGLE

SearchDataManagement

SearchBusinessAnalytics

SearchSAP

SearchSQLServer

TheServerSide

SearchDataCenter

SearchContentManagement

SearchFinancialApplications

Close