1. Learn
  2. /
  3. Courses
  4. /
  5. PostgreSQL Summary Stats and Window Functions

Connected

Exercise

Future gold medalists

Fetching functions allow you to get values from different parts of the table into one row. If you have time-ordered data, you can "peek into the future" with the LEAD fetching function. This is especially useful if you want to compare a current value to a future value.

Instructions

100 XP
  • For each year, fetch the current gold medalist and the gold medalist 3 competitions ahead of the current row.