2014年4月8日星期二

Sameer Borate: Calculating descriptive statistics in MySQL


Sameer Borate has shared some examples of how to generate some meaningful statistics about the contents of your database in a new post to his site today.



Descriptive statistics can be quite useful for simple analysis of records in a database. For example, to calculate average numbers of sales or products for a particular duration, or the Variance of sales for a month etc. We can easily calculate standard descriptive statistic measures in MySQL such as MEAN, SUM, STANDARD DEVIATION, VARIANCE, MIN and MAX using built-in functions.


He includes both the SQL and a bit of PHP code showing how to get these statistics (based on a simple data set of student scores). The PHP is required to more correctly evaluate the median and mode values as it's easier to evaluate those in PHP.


Link: http://www.codediesel.com/data/calculating-descriptive-statistics-in-mysql

没有评论:

发表评论