Structured query language (SQL) for statistical process control

This test structured query language (SQL) script provides the basic foundations to create a simple statistical process control (SPC) individual moving range (XmR) chart.

This test SQL script will help you to create a simple XmR chart, so you can:

  • calculate average line and process limits
  • flag special cause variation and identify improvement or concern in your measures

The script has been preloaded with sample data to allow you to instantly run, test and adapt the script to local data with minimal alteration.

This script as a first step in allowing you to view your data in a more meaningful way. It is intended that more advanced SPC functionality is added by you based on local requirements.

This script is provided under test. You must assure when you apply the script to your own data that you are confident the SPC XmR chart is showing the correct and meaningful message.

You can find out more about correct calculation and interpretation of an SPC chart in Making Data Count.

Statistical process control in SQL

Statistical process control icons in SQL

If you have any comments or feedback, please email