1126. Active Businesses
Description
+---------------+---------+
| Column Name | Type |
+---------------+---------+
| business\_id | int |
| event\_type | varchar |
| occurences | int |
+---------------+---------+
(business\_id, event\_type) is the primary key of this table.
Each row in the table logs the info that an event of some type occurred at some business for a number of times.Events table:
+-------------+------------+------------+
| business\_id | event\_type | occurences |
+-------------+------------+------------+
| 1 | reviews | 7 |
| 3 | reviews | 3 |
| 1 | ads | 11 |
| 2 | ads | 7 |
| 3 | ads | 6 |
| 1 | page views | 3 |
| 2 | page views | 12 |
+-------------+------------+------------+
Result table:
+-------------+
| business\_id |
+-------------+
| 1 |
+-------------+
The average activity for each event can be calculated as follows:
- 'reviews': (7+3)/2 = 5
- 'ads': (11+7+6)/3 = 8
- 'page views': (3+12)/2 = 7.5
The business with id=1 has 7 'reviews' events (more than 5) and 11 'ads' events (more than 8), so it is an active business.ac
Last updated