Skip to content
New Workbook
Sign up
PostgreSQL Summary Stats and Window Functions

PostgreSQL Summary Stats and Window Functions

Here you can access the summer_medals table used in the course. To access the table, you will need to specify the medals schema in your queries (e.g., medals.summer_medals).

Take Notes

Add notes about the concepts you've learned and SQL cells with queries you want to keep.

Add your notes here

Spinner
DataFrameavailable as
movie_info
variable
[4]
-- Add your own queries here
SELECT *
FROM medals.summer_medals
LIMIT 5

Explore Datasets

Use the summer_medals table to explore the data and practice your skills!

  • Select the athlete, event, and year from the summer_medals table.
    • Add another column, previous_winner, which contains the previous winner of the same event.
    • Filter your results for gold medalists.
  • Return the year, total number of medalists per year, and running total number of medalists in the history of the Summer Olympics.
    • Order your results by year in ascending order.
  • Return the country, year, and the number of gold medals earned.
    • Limit your results to the years 2004, 2008, and 2012.
    • Each country should have a subtotal of all gold medals earned across the three years.
Spinner
DataFrameavailable as
df
variable
[5]
select country
medal,
count(*)
from medals.summer_medals
group by country, medal