From the course: Text to SQL: Amazon Redshift Serverless for Generative SQL in Amazon Q
Unlock this course with a free trial
Join today to access over 25,200 courses taught by industry experts.
Ranking the rows on specific criteria
From the course: Text to SQL: Amazon Redshift Serverless for Generative SQL in Amazon Q
Ranking the rows on specific criteria
- [Instructor] Oftentimes, as data analysts and data scientists, we want to be able to extract data from databases and we want to be able to rank our rows according to a specific criteria. In this movie, we'll be focusing on the QS World University Rankings dataset. And we have attributes within the schema that includes employer reputation rank, academic reputation score, and also citation per faculty rank as well. And we'll navigate back to Amazon Redshift and we can click on the icon Amazon Q generative SQL which will allow us to access our chat pane. And we'll start with a question and we'll ask, "Write a query using window function to list the institution sorted in descending order of er score," which was employer reputation score. And we'll wait a few seconds and we can see that Amazon Q has produced the SQL code for us using a window function. And we'll add this to our notebook and we will click on Run and generate our code. So within our results set, it should be ranked…
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
-
-
-
-
-
-
-
-
-
-
Computing a running total5m 37s
-
(Locked)
Finding duplicate rows3m 50s
-
Counting duplicate rows4m 2s
-
(Locked)
Obtaining all rows where the result is in a subquery result5m 50s
-
(Locked)
Grouping data with ROLLUP4m 10s
-
Finding the top 10 rows of a result set6m 10s
-
(Locked)
Ranking the rows on specific criteria3m 20s
-
(Locked)
Listing the highest row of a result set5m 16s
-
-