What does the FIRST_VALUE(revenue) OVER (PARTITION BY region ORDER BY sale_date) return?

SQL Data Analyst Medium

SQL Data Analyst — Medium

What does the FIRST_VALUE(revenue) OVER (PARTITION BY region ORDER BY sale_date) return?

Key points

  • FIRST_VALUE(revenue) returns the value of the specified column from the first row in the partition.
  • The OVER clause defines the partition and order for the function.
  • The ORDER BY clause ensures the revenue is from the first row based on sale date.

Ready to go further?

Related questions