Machine Learning with SQL: Linear Regression

From Theory to Practice, Fully Explained.

Data 4 Everyone!
Learning SQL

--

In a recent article, I covered some time series analysis methods with MySQL 8.

I was reluctant to cover an example of a moving average implementation since the prediction quality is rarely good, even after many preliminary analytical processes.

Since Simple Linear Regression is one of the simplest and easiest Machine Learning models to understand, I wanted to experiment for you with its implementation directly in MySQL with the hope of getting good predictions, or at least better results than with the moving average method!

I will write a mini article on the moving average method soon, as part of the ongoing series on Window Functions 🤓

In this article, you will learn how Simple Linear Regression (y = ax +b) works and how to solve this problem with MySQL 8.

These skills could be helpful for you to predict a future turnover, for example, in a simple (and limited, let’s face it) way.

Machine Learning with SQL: Linear Regression (Photo by ThisisEngineering RAEng)

You can test the examples in this article by downloading the SQL file to get the database used.

1. Presentation of the problem

--

--