From the course: PostgreSQL: Advanced Queries

Unlock the full course today

Join today to access over 24,400 courses taught by industry experts.

Solution: Leverage window functions

Solution: Leverage window functions - PostgreSQL Tutorial

From the course: PostgreSQL: Advanced Queries

Solution: Leverage window functions

(upbeat music) - [Narrator] For this challenge, we were asked to retrieve information about some energy efficient electrical products. I'm going to go ahead and start by running the sample query that we were given here to start, and that'll show us the data that we have to work with. Now for this challenge, we're going to need to return all of these columns, so the product name, category, and price data. So I'm just going to leave everything as is here in the answer to have a comma at the end of line six, and come down to line number seven. Then in the challenge, we were asked to get some statistical information about the products that are in the same category for each row. And one of the things we were asked for was for the minimum price in the category. So I'll go ahead and type in our min function, price. Now, if I leave it just like this, it's going to calculate the minimum price across the entire data set, which is not what I want. For this first row in the results, which is in…

Contents