From the course: MySQL for Advanced Analytics: Tips, Tricks, & Techniques

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Finding IQR and median

Finding IQR and median - MySQL Tutorial

From the course: MySQL for Advanced Analytics: Tips, Tricks, & Techniques

Start my 1-month free trial

Finding IQR and median

- [Instructor] I'm going to show you how to compute the interquartile range, or IQR, and the median for a data series. What is IQR? In simple terms, if you have a hundred values and sort them in order, IQR is the difference between the 25th value and the 75th value in the list. Let us take a data set of 200 values and sort it in ascending order. The first quartile is a range that represents the value up to the 25th percentage position. So, in this case, the first quartile will include the first 50 values out of the 200. The median is exactly at 50%, so that will be the 100th value among 200. The third quartile ends at 75% of the values, so that range includes the 101st value to the 150th value. Computing them is not straightforward in MySQL, but it is possible with a few tricks. Now let us take a look at the SQL. We're going to open the exercise file, and that is called Finding IQR and Median. We're going to find the IQR and median for the duration column. First, we set the number of…

Contents