From the course: Practice It: Advanced SQL

Unlock this course with a free trial

Join today to access over 25,500 courses taught by industry experts.

Check it: Extracting the year and month

Check it: Extracting the year and month - SQL Tutorial

From the course: Practice It: Advanced SQL

Check it: Extracting the year and month

(bright music) - [Instructor] So starting with our from clause in line 25, we will be pulling our data from our events table. Then in our select statement, we will use SDRFTIME function to format our event date column to the string of year-month format to represent the month and the year only. And we'll alias this as MonthYear. After that, we'll calculate the total revenue by using the sum of ticket price and aliasing that as total revenue. We'll then finish our query by ordering it by the month-year alias that we just created. In summary, this SQL code provides a way to analyze event data by grouping events based on their month and year, calculating the total revenue generated for each month-year combination, and ordering the results chronologically. It allows you to see how event revenue varies over time and provides insights into the seasonality or trends in event revenue. And these are your results.

Contents