Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8432551
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T06:09:27+00:00 2026-06-10T06:09:27+00:00

X is column with a mixture of numerical and null values. I don’t understand

  • 0

X is column with a mixture of numerical and null values.

I don’t understand why treating null values as 0 changes the result of the AVG value.

Shouldn’t it be like this,

(2 + null + 2) / 3 = 2 -- with null value

(2 + 0 + 2) / 3 = 2     -- no null value
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T06:09:28+00:00Added an answer on June 10, 2026 at 6:09 am

    If you have null value, it is not being taken into account, hence number of elements (your n) is not increased, whereas 0 is treated as a valid value.

    For example if you have: 1,1,6,7,null,3,2 it will be total 20 divided by 6 (i.e. 3.33). However if you replace null with 0 it becomes 20 /7 (i.e. 2.86).

    SQLFiddle demonstrating this behavior on MySQL server.

    REFERENCE: Have a look in the documentation right below the table:

    This section describes group (aggregate) functions that operate on sets of values. Unless otherwise stated, group functions ignore NULL values.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

A column name rcvdate, which is having datetime type, the value is like this:
One column in my database (of type double) has some null values. I am
Date column is created using colmodel below. This column shows values like 0101.0101.7070 for
original column is like: 0.45::rafas::4.0::0.0::0.9 0.35::rasaf::4.0::110.0::1.0 and i would like to break the string
My column's datatype is decimal(18,0) but when I am entering value in to database
If column allow does not allow NULL in db then a condition in setter
If column Y contains only positive values, the following awk command works fine: $
What column type in Oracle 10g can be used to store any value of
I have a datetime column and I would like to select rows based on
Oracle column: user_id int not null, Linq query: UserId = user.Field<int>(user_id), UserId is int

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.