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,400 courses taught by industry experts.
Grouping data with ROLLUP
From the course: Text to SQL: Amazon Redshift Serverless for Generative SQL in Amazon Q
Grouping data with ROLLUP
- [Instructor] In this movie, we'll be exploring how to group data using rollup in SQL. So as we revisit our data model again, we'll be having a look at the higher education employee salaries table where we have variables such as department, earnings, name of the school, and also job description. And we'll also be revisiting the PhD table, which includes variables such as academic year, department, living wage ratio, and also 12 month gross pay. So let's navigate to Amazon Redshift. And we'll open up our editor. And we can tap into this icon to access the chat pane. And we'll start by asking a very simple question. So we'll ask, perform a rollup of the total 12 month gross pay for the university that offers computer science in the academic year. So I want to make my prompt as specific as possible. So I only want the results from the academic year, which is 2020 to 2021. So this was during the time of COVID. So I want to ask Amazon Q, please perform a rollup of the total 12 month gross…
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
-
-