1581. Customer Who Visited but Did Not Make Any Transactions

https://leetcode.com/problems/customer-who-visited-but-did-not-make-any-transactions

Description

Table: Visits

+-------------+---------+
| Column Name | Type    |
+-------------+---------+
| visit\_id    | int     |
| customer\_id | int     |
+-------------+---------+
visit\_id is the primary key for this table.
This table contains information about the customers who visited the mall.

Table: Transactions

+----------------+---------+
| Column Name    | Type    |
+----------------+---------+
| transaction\_id | int     |
| visit\_id       | int     |
| amount         | int     |
+----------------+---------+
transaction\_id is the primary key for this table.
This table contains information about the transactions made during the visit\_id.

Write an SQL query to find the IDs of the users who visited without making any transactions and the number of times they made these types of visits.

Return the result table sorted in any order.

The query result format is in the following example:

ac

Last updated

Was this helpful?