Ten challenges against the events database, from warm-up SELECTs to window functions. Each opens in its own editor — try writing the query yourself before revealing the solution.
List all upcoming events (starting today or later) with their category, date and ticket price — soonest first. SQLite gives you today with date('now').
Open in editor →Find all events happening at Bangalore venues. Show the event name, the venue name, and the date.
Open in editor →Some events cost nothing. List every free event with its category and start date.
Open in editor →For each category, show how many events it has and the average ticket price (rounded), most expensive category first.
Open in editor →List only the categories whose average ticket price is above 1000. (Hint: you filter groups with HAVING, not WHERE.)
Open in editor →Online events have no venue. Find them, and show each one's organizer name too. (Hint: NULL needs IS, not =.)
Open in editor →Find attendees registered for more than 2 events. Show their name, how many events they're attending, and their total spend.
Open in editor →For every event show its name, tickets sold, and total revenue — including events that haven't sold a single ticket yet.
Open in editor →Find events whose ticket price is above the average price of their own category. Show the name, price, and the category average. (Hint: correlated subquery.)
Open in editor →Show the top 2 highest-grossing events in each category, with their revenue rank. (Hint: compute revenue in a CTE, then ROW_NUMBER() over each category.)
Open in editor →