avg_occurrences) to calculate the average occurrences for each event type using the AVG function and GROUP BY event_type.INNER JOIN between the Events table and the subquery on the event_type column.WHERE clause to filter the results where the occurrences of an event for a business are greater than the average occurrences of that event type.GROUP BY clause.HAVING clause to filter groups that have a count of distinct event types greater than 1, indicating active businesses.
erDiagram
Events {
int business_id
varchar event_type
int occurrences
business_id event_type PK
}