From the course: PostgreSQL: Advanced Queries
Unlock the full course today
Join today to access over 24,800 courses taught by industry experts.
Determine the range of values within a dataset - PostgreSQL Tutorial
From the course: PostgreSQL: Advanced Queries
Determine the range of values within a dataset
- [Narrator] The range of a dataset is the last statistical measurement of central tendency that we have yet to look at. But truth be told, this is just a simple subtraction calculation, and there's no PostgreSQL function to calculate this value. I'm simply including this movie for completeness sake. To calculate the range of a dataset, all we need to do is subtract the minimum value from the maximum value. So to find the range of our height data, we could write out the query like this. It would say select, use the max function against the height inches column, and we'll subtract the min function, applied to the height inches column. That completes the calculation. Let's give it an alias, I'll call it height range, and we'll pull the data from the public dot people heights table. So that's all there is to the range calculation. I'll execute the query, and it tells me that my data has a range of 19 and a half inches.…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
(Locked)
Calculate the median value of a dataset6m 25s
-
(Locked)
Calculate the first and third quartiles of a dataset5m 47s
-
(Locked)
Find the most frequent value within a dataset with MODE2m 57s
-
(Locked)
Determine the range of values within a dataset2m 13s
-
(Locked)
Solution: Retrieve statistics of a dataset with groups4m 57s
-
(Locked)
-
-
-
-