Customer Who Visited but Did Not Make Any Transactions
Task: Find the IDs of the users who visited without making any transactions and the number of times they made these types of visits.
Table: Visits
+-------------+------+
| Column Name | Type |
+-------------+------+
| visit_id | INT |
| customer_id | INT |
+-------------+------+
Table: Transactions
+----------------+------+
| Column Name | Type |
+----------------+------+
| transaction_id | INT |
| visit_id | INT |
| amount | INT |
+----------------+------+
Input: Visits table:
+----------+-------------+
| visit_id | customer_id |
+----------+-------------+
| 1 | 23 |
| 2 | 9 |
| 4 | 30 |
| 5 | 54 |
| 6 | 96 |
| 7 | 54 |
| 8 | 54 |
+----------+-------------+
Transactions table:
+----------------+----------+--------+
| transaction_id | visit_id | amount |
+----------------+----------+--------+
| 2 | 5 | 310 |
| 3 | 5 | 300 |
| 9 | 5 | 200 |
| 12 | 1 | 910 |
| 13 | 2 | 970 |
+----------------+----------+--------+
Output:
+-------------+----------------+
| customer_id | count_no_trans |
+-------------+----------------+
| 30 | 1 |
| 54 | 2 |
| 96 | 1 |
+-------------+----------------+