Skip to content
Online Ticket Sales Database
  • AI Chat
  • Code
  • Report
  • Online Ticket Sales Database

    👋 Welcome to your workspace! Here, you can run SQL queries, write Python code, and add text in Markdown. This workspace is automatically connected to an Amazon Redshift database containing tables about online ticket sales (source).

    You can click the "Browse tables" button in the upper righthand corner of the cell below to view the available tables.

    There is a short query and a visualization of the number of tickets sold and the price per ticket over time rendered in Plotly to get you started.

    Spinner
    DataFrameavailable as
    ticket_prices
    variable
    SELECT 
        caldate, 
        eventname,  
        catgroup, 
        priceperticket,
        SUM(qtysold) AS qtysold
    FROM event
    INNER JOIN category USING(catid)
    INNER JOIN date USING(dateid)
    INNER JOIN sales USING(eventid)
    INNER JOIN listing USING(eventid)
    GROUP BY caldate, eventname, catgroup, priceperticket
    ORDER BY qtysold DESC
    LIMIT 100
    # Import libraries
    import pandas as pd
    import plotly.express as px
    
    # Create scatter plot
    fig = px.scatter(
        ticket_prices,
        x="caldate",
        y="qtysold",
        color="catgroup",
        size="priceperticket",
        hover_data=["eventname"],
    )
    
    # Create labels and show plot
    fig.update_layout(
        title="Biggest Concerts and Shows over Time<br><sup>By Quantity Sold and Price of Tickets</sup>",
        title_x=0.5,
        xaxis_title="Date",
        yaxis_title="Quantity Sold",
        legend_title="Category",
        template="plotly_dark",
    )
    fig.show()

    This is an interactive plot! Hover over different points to learn the details of each event.


    💪 Now it's your turn to construct your own queries and analyze the data! Remember, you can review the tables in the database at any point using the "Browse tables" button.