{"id":7022,"date":"2023-07-07T00:00:00","date_gmt":"2023-07-07T04:00:00","guid":{"rendered":"https:\/\/www.sisense.com\/outlier-detection-in-sql\/"},"modified":"2024-09-23T15:28:12","modified_gmt":"2024-09-23T19:28:12","slug":"outlier-detection-in-sql","status":"publish","type":"post","link":"https:\/\/www.sisense.com\/blog\/outlier-detection-in-sql\/","title":{"rendered":"Outlier detection in SQL"},"content":{"rendered":"<p><\/p>\r\n<p>Inevitably, the unexpected happens. A historically low-traffic channel brings in 10x the normal amount of users. Or your user login rate drops by half. In either case, these are important events that are easy to miss in a sea of data.<\/p>\r\n<p>In this post we\u2019ll cover a few SQL queries for detecting unusually high or low values in a set of data.<\/p>\r\n<h2>Static thresholds<\/h2>\r\n<p>We\u2019ll start by using a static threshold in the query below to find rows above or below that threshold. This works well for key numbers that behave in predictable ways, and is trivial to implement.<\/p>\r\n<p>Let\u2019s define a\u00a0<strong><em>with<\/em><\/strong>\u00a0table of user data and see what it looks like:<\/p>\r\n<pre class=\"wp-block-code\"><code>with user_count as (\r\n  select\r\n    date_trunc('day', created_at)::date as day,\r\n    count(1) as value\r\n  from users\r\n  group by 1\r\n)\r\nselect * from user_count<\/code><\/pre>\r\n<figure class=\"wp-block-image fancybox\"><img decoding=\"async\" class=\"wp-image-78070\" src=\"https:\/\/cdn.sisense.com\/wp-content\/uploads\/image-01-8.png\" alt=\"With table\" \/><\/figure>\r\n<p>Let\u2019s define outliers as any day with more than a thousand new users:<\/p>\r\n<pre class=\"wp-block-code\"><code>select *\r\nfrom user_count\r\nwhere value &gt; 1000<\/code><\/pre>\r\n<figure class=\"wp-block-image fancybox\"><img decoding=\"async\" class=\"wp-image-78064\" src=\"https:\/\/cdn.sisense.com\/wp-content\/uploads\/image-02-9.png\" alt=\"Outlier table\" \/><\/figure>\r\n<p>When we plot the outliers on top of the full data we see:<\/p>\r\n<figure class=\"wp-block-image fancybox\"><img decoding=\"async\" class=\"wp-image-78058\" src=\"https:\/\/cdn.sisense.com\/wp-content\/uploads\/image-03-9.png\" alt=\"New users and outliers\" \/><\/figure>\r\n<p>Static thresholds are simple and effective for basic use cases, but run into problems when data varies month to month and the old fixed threshold no longer applies.<\/p>\r\n<h2>Percentage thresholds<\/h2>\r\n<p>Percentage thresholds work well for data with a growth trend. A thousand new users per day may be unexpected in January, but typical by July.<\/p>\r\n<p>With percentage thresholds, our alerts will continually adjust to recent trends. Rather than setting a threshold at a thousand new users, we can set one at 2x the current average.<\/p>\r\n<p>First let\u2019s add another\u00a0<strong><em>with<\/em><\/strong>\u00a0table to include the percentage difference vs. the mean for each data point:<\/p>\r\n<pre class=\"wp-block-code\"><code>with user_count as (\r\n  select\r\n    date_trunc('day', created_at)::date as day,\r\n    count(1) as value\r\n  from users\r\n  group by 1\r\n), user_count_with_pct as (\r\n  select\r\n    day,\r\n    value,\r\n    value \/ (avg(value) over ()) as pct_of_mean\r\n  from user_count\r\n  order by 1\r\n)\r\nselect * from user_count_with_pct<\/code><\/pre>\r\n<p>The line\u00a0<strong><em>value \/ (avg(value) over ())<\/em><\/strong>\u00a0uses a window function to divide each row\u2019s value by the average value for the entire table. The results are:<\/p>\r\n<figure class=\"wp-block-image fancybox\"><img decoding=\"async\" class=\"wp-image-78052\" src=\"https:\/\/cdn.sisense.com\/wp-content\/uploads\/image-04-9.png\" alt=\"Average value table\" \/><\/figure>\r\n<p>If we limit to outliers:<\/p>\r\n<pre class=\"wp-block-code\"><code>select *\r\nfrom user_count_with_pct\r\nwhere pct &gt;= 2.0<\/code><\/pre>\r\n<p>We see the days where we had 200%+ of the average signup rate:<\/p>\r\n<figure class=\"wp-block-image fancybox\"><img decoding=\"async\" class=\"wp-image-78046\" src=\"https:\/\/cdn.sisense.com\/wp-content\/uploads\/image-05-7.png\" alt=\"200 percent chart\" \/><\/figure>\r\n<p>Plotted together:<\/p>\r\n<figure class=\"wp-block-image fancybox\"><img decoding=\"async\" class=\"wp-image-78040\" src=\"https:\/\/cdn.sisense.com\/wp-content\/uploads\/image-06-4.png\" alt=\"New users and outliers graph\" \/><\/figure>\r\n<p>We could make this more robust by limiting the\u00a0<strong><em>user_count<\/em><\/strong>\u00a0table to just recent users. This prevents skewing the average with data from several months ago.<\/p>\r\n<h2>Standard deviation thresholds<\/h2>\r\n<p>While the percentage thresholds are flexible, they still manually picking the threshold. It would convenient if we had a query that would automatically pick a threshold for rare events.<\/p>\r\n<p>Fortunately, we can use <a href=\"https:\/\/en.wikipedia.org\/wiki\/Standard_deviation\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\">standard deviations<\/a>. We can automatically define thresholds appropriate for data with either low variance (30% disk usage +\/- 1%) or high variance (30% signup rate +\/- 10%).<\/p>\r\n<p>We then choose how sensitive we want to be to outliers. Do we want to detect events with a 5% chance, or a 0.1% chance? Additionally, we have to choose if we care about both high and low values (<a href=\"https:\/\/en.wikipedia.org\/wiki\/One-_and_two-tailed_tests\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\">a two-tailed test<\/a>), or just one of the two (<a href=\"https:\/\/en.wikipedia.org\/wiki\/One-_and_two-tailed_tests\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\">a one-tailed test<\/a>).<\/p>\r\n<p>First, we need to pick a z score (number of standard deviations) threshold. <a href=\"http:\/\/sphweb.bumc.bu.edu\/otlt\/MPH-Modules\/BS\/BS704_HypothesisTest-Means-Proportions\/BS704_HypothesisTest-Means-Proportions3.html\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\">This page from Boston University<\/a> has a good explanation and z-scores for different probabilities.<\/p>\r\n<p>For example, if we care about high or low values that occur only 5% of the time by random chance, we\u2019d use a z score threshold of +\/- 1.645. If we want a 5% threshold exclusively for high values, we\u2019d pick 1.96.<\/p>\r\n<p>Here\u2019s the SQL for calculating z-scores for the low variance disk usage data:<\/p>\r\n<pre class=\"wp-block-code\"><code>with data as (\r\n  select\r\n    date_trunc('day', created_at)::date as day,\r\n    count(1) as value\r\n  from disk_usage\r\n  group by 1\r\n), data_with_stddev as (\r\n  select\r\n    day,\r\n    value,\r\n    (value - avg(value) over ())\r\n     \/ (stddev(value) over ()) as zscore\r\n  from data\r\n  order by 1\r\n)\r\nselect * from data_with_stddev<\/code><\/pre>\r\n<figure class=\"wp-block-image fancybox\"><img decoding=\"async\" class=\"wp-image-78094\" src=\"https:\/\/cdn.sisense.com\/wp-content\/uploads\/image-07-1.png\" alt=\"low variance\" \/><\/figure>\r\n<p>This is the same query as the percent threshold, but we calculate zscore instead of percent deviation from the mean. The first part of the calculation is\u00a0<strong><em>(value &#8211; avg(value) over ())<\/em><\/strong>\u00a0which calculates how much a single datapoint deviates from the mean.<\/p>\r\n<p>The second part\u00a0<strong><em>\/ (stddev(value) over ())<\/em><\/strong>\u00a0divides the deviation by the standard deviation, to measure how many standard deviations the data point is from the mean.<\/p>\r\n<p>Here\u2019s the outlier query for a two-tailed 5% threshold:<\/p>\r\n<pre class=\"wp-block-code\"><code>select *\r\nfrom data_with_stddev\r\nwhere abs(zscore) &gt;= 1.645<\/code><\/pre>\r\n<figure class=\"wp-block-image fancybox\"><img decoding=\"async\" class=\"wp-image-78088\" src=\"https:\/\/cdn.sisense.com\/wp-content\/uploads\/image-081.png\" alt=\"Low variance table\" \/><\/figure>\r\n<p>Plotting the disk usage data and outliers together:<\/p>\r\n<figure class=\"wp-block-image fancybox\"><img decoding=\"async\" class=\"wp-image-78082\" src=\"https:\/\/cdn.sisense.com\/wp-content\/uploads\/image-091.png\" alt=\"Disk usage\" \/><\/figure>\r\n<p>And swapping in the high variance signup rate data:<\/p>\r\n<figure class=\"wp-block-image fancybox\"><img decoding=\"async\" class=\"wp-image-78076\" src=\"https:\/\/cdn.sisense.com\/wp-content\/uploads\/image-101.png\" alt=\"Signup rate\" \/><\/figure>\r\n<p>We\u2019ve applied the same standard deviation threshold to queries with very different data, and can still detect the outliers.<\/p>\r\n<h2>Well, that was unexpected!<\/h2>\r\n<p>We now have a few techniques for finding unusual results. Enjoy discovering the unpredictable in your data!<\/p>\r\n<p>\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n<\/p>","protected":false},"excerpt":{"rendered":"<p>Inevitably, the unexpected happens. A historically low-traffic channel brings in 10x the normal amount of users. Or your user login rate drops by half. In either case, these are important events that are easy to miss in a sea of&#8230;<\/p>\n","protected":false},"author":4,"featured_media":7215,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_searchwp_excluded":"","footnotes":"","_links_to":"","_links_to_target":""},"categories":[50],"tags":[472],"application":[10],"buyer-role":[],"buyer-stage":[],"department":[],"industry":[],"topic":[],"class_list":["post-7022","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-bi-best-practices","tag-data-team","application-cloud-data-teams"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v23.5 (Yoast SEO v23.8) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Outlier Detection in SQL | Sisense<\/title>\n<meta name=\"description\" content=\"In this post, we\u2019ll cover some SQL queries for detecting unusually high or low values in a set of data, so you don&#039;t miss an important event.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.sisense.com\/blog\/outlier-detection-in-sql\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Outlier detection in SQL\" \/>\n<meta property=\"og:description\" content=\"Inevitably, the unexpected happens. A historically low-traffic channel brings in 10x the normal amount of users. Or your user login rate drops by half. In\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.sisense.com\/blog\/outlier-detection-in-sql\/\" \/>\n<meta property=\"og:site_name\" content=\"Sisense\" \/>\n<meta property=\"article:published_time\" content=\"2023-07-07T04:00:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-09-23T19:28:12+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/cdn.sisense.com\/wp-content\/uploads\/yoast-image-69.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Sisense Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:image\" content=\"https:\/\/cdn.sisense.com\/wp-content\/uploads\/yoast-image-69.jpg\" \/>\n<meta name=\"twitter:creator\" content=\"@sisense\" \/>\n<meta name=\"twitter:site\" content=\"@sisense\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Sisense Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.sisense.com\/blog\/outlier-detection-in-sql\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.sisense.com\/blog\/outlier-detection-in-sql\/\"},\"author\":{\"name\":\"Sisense Team\",\"@id\":\"https:\/\/www.sisense.com\/#\/schema\/person\/e70aa3a7bbc471e4b7b8c5a7d2b36115\"},\"headline\":\"Outlier detection in SQL\",\"datePublished\":\"2023-07-07T04:00:00+00:00\",\"dateModified\":\"2024-09-23T19:28:12+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.sisense.com\/blog\/outlier-detection-in-sql\/\"},\"wordCount\":649,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.sisense.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.sisense.com\/blog\/outlier-detection-in-sql\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/cdn.sisense.com\/wp-content\/uploads\/2016\/01\/10161741\/featured-image-68.jpg\",\"keywords\":[\"data team\"],\"articleSection\":[\"BI Best Practices\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.sisense.com\/blog\/outlier-detection-in-sql\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.sisense.com\/blog\/outlier-detection-in-sql\/\",\"url\":\"https:\/\/www.sisense.com\/blog\/outlier-detection-in-sql\/\",\"name\":\"Outlier Detection in SQL | Sisense\",\"isPartOf\":{\"@id\":\"https:\/\/www.sisense.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.sisense.com\/blog\/outlier-detection-in-sql\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.sisense.com\/blog\/outlier-detection-in-sql\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/cdn.sisense.com\/wp-content\/uploads\/2016\/01\/10161741\/featured-image-68.jpg\",\"datePublished\":\"2023-07-07T04:00:00+00:00\",\"dateModified\":\"2024-09-23T19:28:12+00:00\",\"description\":\"In this post, we\u2019ll cover some SQL queries for detecting unusually high or low values in a set of data, so you don't miss an important event.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.sisense.com\/blog\/outlier-detection-in-sql\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.sisense.com\/blog\/outlier-detection-in-sql\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.sisense.com\/blog\/outlier-detection-in-sql\/#primaryimage\",\"url\":\"https:\/\/cdn.sisense.com\/wp-content\/uploads\/2016\/01\/10161741\/featured-image-68.jpg\",\"contentUrl\":\"https:\/\/cdn.sisense.com\/wp-content\/uploads\/2016\/01\/10161741\/featured-image-68.jpg\",\"width\":1200,\"height\":628,\"caption\":\"featured image 68\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.sisense.com\/blog\/outlier-detection-in-sql\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.sisense.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Outlier detection in SQL\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.sisense.com\/#website\",\"url\":\"https:\/\/www.sisense.com\/\",\"name\":\"Sisense\",\"description\":\"Build your business with anywhere-analytics\",\"publisher\":{\"@id\":\"https:\/\/www.sisense.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.sisense.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.sisense.com\/#organization\",\"name\":\"Sisense\",\"url\":\"https:\/\/www.sisense.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.sisense.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/cdn.sisense.com\/wp-content\/uploads\/sisense-yoast-og.jpg\",\"contentUrl\":\"https:\/\/cdn.sisense.com\/wp-content\/uploads\/sisense-yoast-og.jpg\",\"width\":1200,\"height\":600,\"caption\":\"Sisense\"},\"image\":{\"@id\":\"https:\/\/www.sisense.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/x.com\/sisense\",\"https:\/\/www.linkedin.com\/company\/sisense\",\"https:\/\/github.com\/sisense\/\"],\"description\":\"Sisense accelerates product innovation through AI\/ML capabilities. Our global analytics platform lets customers drive better, faster decisions for their business and end users.\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.sisense.com\/#\/schema\/person\/e70aa3a7bbc471e4b7b8c5a7d2b36115\",\"name\":\"Sisense Team\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.sisense.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/213e415f47bc3c7f0155a0755b1cea8c?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/213e415f47bc3c7f0155a0755b1cea8c?s=96&d=mm&r=g\",\"caption\":\"Sisense Team\"}}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Outlier Detection in SQL | Sisense","description":"In this post, we\u2019ll cover some SQL queries for detecting unusually high or low values in a set of data, so you don't miss an important event.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.sisense.com\/blog\/outlier-detection-in-sql\/","og_locale":"en_US","og_type":"article","og_title":"Outlier detection in SQL","og_description":"Inevitably, the unexpected happens. A historically low-traffic channel brings in 10x the normal amount of users. Or your user login rate drops by half. In","og_url":"https:\/\/www.sisense.com\/blog\/outlier-detection-in-sql\/","og_site_name":"Sisense","article_published_time":"2023-07-07T04:00:00+00:00","article_modified_time":"2024-09-23T19:28:12+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/cdn.sisense.com\/wp-content\/uploads\/yoast-image-69.jpg","type":"image\/jpeg"}],"author":"Sisense Team","twitter_card":"summary_large_image","twitter_image":"https:\/\/cdn.sisense.com\/wp-content\/uploads\/yoast-image-69.jpg","twitter_creator":"@sisense","twitter_site":"@sisense","twitter_misc":{"Written by":"Sisense Team","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.sisense.com\/blog\/outlier-detection-in-sql\/#article","isPartOf":{"@id":"https:\/\/www.sisense.com\/blog\/outlier-detection-in-sql\/"},"author":{"name":"Sisense Team","@id":"https:\/\/www.sisense.com\/#\/schema\/person\/e70aa3a7bbc471e4b7b8c5a7d2b36115"},"headline":"Outlier detection in SQL","datePublished":"2023-07-07T04:00:00+00:00","dateModified":"2024-09-23T19:28:12+00:00","mainEntityOfPage":{"@id":"https:\/\/www.sisense.com\/blog\/outlier-detection-in-sql\/"},"wordCount":649,"commentCount":0,"publisher":{"@id":"https:\/\/www.sisense.com\/#organization"},"image":{"@id":"https:\/\/www.sisense.com\/blog\/outlier-detection-in-sql\/#primaryimage"},"thumbnailUrl":"https:\/\/cdn.sisense.com\/wp-content\/uploads\/2016\/01\/10161741\/featured-image-68.jpg","keywords":["data team"],"articleSection":["BI Best Practices"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.sisense.com\/blog\/outlier-detection-in-sql\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.sisense.com\/blog\/outlier-detection-in-sql\/","url":"https:\/\/www.sisense.com\/blog\/outlier-detection-in-sql\/","name":"Outlier Detection in SQL | Sisense","isPartOf":{"@id":"https:\/\/www.sisense.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.sisense.com\/blog\/outlier-detection-in-sql\/#primaryimage"},"image":{"@id":"https:\/\/www.sisense.com\/blog\/outlier-detection-in-sql\/#primaryimage"},"thumbnailUrl":"https:\/\/cdn.sisense.com\/wp-content\/uploads\/2016\/01\/10161741\/featured-image-68.jpg","datePublished":"2023-07-07T04:00:00+00:00","dateModified":"2024-09-23T19:28:12+00:00","description":"In this post, we\u2019ll cover some SQL queries for detecting unusually high or low values in a set of data, so you don't miss an important event.","breadcrumb":{"@id":"https:\/\/www.sisense.com\/blog\/outlier-detection-in-sql\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.sisense.com\/blog\/outlier-detection-in-sql\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.sisense.com\/blog\/outlier-detection-in-sql\/#primaryimage","url":"https:\/\/cdn.sisense.com\/wp-content\/uploads\/2016\/01\/10161741\/featured-image-68.jpg","contentUrl":"https:\/\/cdn.sisense.com\/wp-content\/uploads\/2016\/01\/10161741\/featured-image-68.jpg","width":1200,"height":628,"caption":"featured image 68"},{"@type":"BreadcrumbList","@id":"https:\/\/www.sisense.com\/blog\/outlier-detection-in-sql\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.sisense.com\/"},{"@type":"ListItem","position":2,"name":"Outlier detection in SQL"}]},{"@type":"WebSite","@id":"https:\/\/www.sisense.com\/#website","url":"https:\/\/www.sisense.com\/","name":"Sisense","description":"Build your business with anywhere-analytics","publisher":{"@id":"https:\/\/www.sisense.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.sisense.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.sisense.com\/#organization","name":"Sisense","url":"https:\/\/www.sisense.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.sisense.com\/#\/schema\/logo\/image\/","url":"https:\/\/cdn.sisense.com\/wp-content\/uploads\/sisense-yoast-og.jpg","contentUrl":"https:\/\/cdn.sisense.com\/wp-content\/uploads\/sisense-yoast-og.jpg","width":1200,"height":600,"caption":"Sisense"},"image":{"@id":"https:\/\/www.sisense.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/x.com\/sisense","https:\/\/www.linkedin.com\/company\/sisense","https:\/\/github.com\/sisense\/"],"description":"Sisense accelerates product innovation through AI\/ML capabilities. Our global analytics platform lets customers drive better, faster decisions for their business and end users."},{"@type":"Person","@id":"https:\/\/www.sisense.com\/#\/schema\/person\/e70aa3a7bbc471e4b7b8c5a7d2b36115","name":"Sisense Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.sisense.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/213e415f47bc3c7f0155a0755b1cea8c?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/213e415f47bc3c7f0155a0755b1cea8c?s=96&d=mm&r=g","caption":"Sisense Team"}}]}},"_links":{"self":[{"href":"https:\/\/www.sisense.com\/wp-json\/wp\/v2\/posts\/7022"}],"collection":[{"href":"https:\/\/www.sisense.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sisense.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sisense.com\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sisense.com\/wp-json\/wp\/v2\/comments?post=7022"}],"version-history":[{"count":0,"href":"https:\/\/www.sisense.com\/wp-json\/wp\/v2\/posts\/7022\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.sisense.com\/wp-json\/wp\/v2\/media\/7215"}],"wp:attachment":[{"href":"https:\/\/www.sisense.com\/wp-json\/wp\/v2\/media?parent=7022"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sisense.com\/wp-json\/wp\/v2\/categories?post=7022"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sisense.com\/wp-json\/wp\/v2\/tags?post=7022"},{"taxonomy":"application","embeddable":true,"href":"https:\/\/www.sisense.com\/wp-json\/wp\/v2\/application?post=7022"},{"taxonomy":"buyer-role","embeddable":true,"href":"https:\/\/www.sisense.com\/wp-json\/wp\/v2\/buyer-role?post=7022"},{"taxonomy":"buyer-stage","embeddable":true,"href":"https:\/\/www.sisense.com\/wp-json\/wp\/v2\/buyer-stage?post=7022"},{"taxonomy":"department","embeddable":true,"href":"https:\/\/www.sisense.com\/wp-json\/wp\/v2\/department?post=7022"},{"taxonomy":"industry","embeddable":true,"href":"https:\/\/www.sisense.com\/wp-json\/wp\/v2\/industry?post=7022"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.sisense.com\/wp-json\/wp\/v2\/topic?post=7022"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}