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

  • SEARCH
  • Home
  • 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 8567281
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T17:50:47+00:00 2026-06-11T17:50:47+00:00

Standard deviation analysis can be a useful way to find outliers. Is there a

  • 0

Standard deviation analysis can be a useful way to find outliers. Is there a way to incorporate the result of this query (finding the value of the fourth standard deviation away from the mean)…

SELECT (AVG(weight_pounds) + STDDEV(weight_pounds) * 4) as high FROM [publicdata:samples.natality];

result = 12.721342001626912

…Into another query that produces information about which states and dates have the most babies born heavier that 4 standard deviations from average?

SELECT state, year, month ,COUNT(*) AS outlier_count
 FROM [publicdata:samples.natality]
WHERE
  (weight_pounds > 12.721342001626912)
AND
  (state != '' AND state IS NOT NULL)
GROUP BY state, year, month 
ORDER BY outlier_count DESC;

Result:

Row  state   year    month   outlier_count    
1    MD  1990    12  22   
2    NY  1989    10  17   
3    CA  1991    9   14

Essentially it would be great to combine this into a single query.

  • 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-11T17:50:49+00:00Added an answer on June 11, 2026 at 5:50 pm

    You can abuse JOIN for this (and thus performance will suffer):

    SELECT n.state, n.year, n.month ,COUNT(*) AS outlier_count
    FROM (
      SELECT state, year, month, weight_pounds, 1 as key 
      FROM [publicdata:samples.natality]) as n
    JOIN (
      SELECT (AVG(weight_pounds) + STDDEV(weight_pounds) * 4) as giant_baby, 
              1 as key 
      FROM [publicdata:samples.natality]) as o
    ON n.key = o.key
    WHERE
      (n.weight_pounds > o.giant_baby)
    AND
      (n.state != '' AND n.state IS NOT NULL)
    GROUP BY n.state, n.year, n.month 
    ORDER BY outlier_count DESC;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can anyone help me with this: I have calculated 2 different values: standard deviation
Is there a way to represent a time value in Excel where hours can
Is there a way to plot graphs with +-standard deviation about the mean using
Is there a way to generate a Bell curve from a standard deviation and
I have this code to find the mean and standard deviation of some input
Standard Fancybox places an overlay on the entire body. Is there a way in
In standard SQL, is there a way to say: select mubmle as x from
What's an efficient way to calculate a trimmed or winsorized standard deviation of a
I am trying to eliminate outliers in SQL Server 2008 by standard deviation. I
I need to determine the standard deviation of a set of inputs. This requires

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.