# Simple Anomaly Detection Using Plain SQL

DevFeed: [Simple Anomaly Detection Using Plain SQL](<https://devfeed.tech/articles/simple-anomaly-detection-using-plain-sql-33935.md>)

Original publisher: [Read original article](<https://hakibenita.com/sql-anomaly-detection>)

Author: Haki Benita

Published: 2020-09-20T21:00:00Z

Content type: tutorial

Language: en

Sources: [Haki Benita](<https://devfeed.tech/sources/haki-benita.md>)

Topics: [SQL](<https://devfeed.tech/topics/sql.md>), [Statistics](<https://devfeed.tech/topics/statistics.md>), [Code](<https://devfeed.tech/topics/code.md>)

Tags: [anomaly-detection](<https://devfeed.tech/tags/anomaly-detection.md>), [articles](<https://devfeed.tech/tags/articles.md>), [query](<https://devfeed.tech/tags/query.md>), [sql](<https://devfeed.tech/tags/sql.md>), [statistics](<https://devfeed.tech/tags/statistics.md>)

## AI overview

A developer explains how to build a simple anomaly detection system using plain SQL and basic statistics. The tutorial defines anomalies using the mean, standard deviation, acceptable ranges, and z-scores, with SQL queries applied to example data.

## Source excerpt

Many developers think that having a critical bug in their code is the worse thing that can happen. Well, there is something much worst than that: Having a critical bug in your code and not knowing about it! Using some high school level statistics and a fair knowledge of SQL, I implemented a very simple anomaly detection system.