-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added README.md file for Customer Who Visited but Did Not Make Any Tr…
…ansactions
- Loading branch information
Showing
1 changed file
with
80 additions
and
0 deletions.
There are no files selected for viewing
80 changes: 80 additions & 0 deletions
80
1724-customer-who-visited-but-did-not-make-any-transactions/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
<h2><a href="https://leetcode.com/problems/customer-who-visited-but-did-not-make-any-transactions">Customer Who Visited but Did Not Make Any Transactions</a></h2> <img src='https://img.shields.io/badge/Difficulty-Easy-brightgreen' alt='Difficulty: Easy' /><hr><p>Table: <code>Visits</code></p> | ||
|
||
<pre> | ||
+-------------+---------+ | ||
| Column Name | Type | | ||
+-------------+---------+ | ||
| visit_id | int | | ||
| customer_id | int | | ||
+-------------+---------+ | ||
visit_id is the column with unique values for this table. | ||
This table contains information about the customers who visited the mall. | ||
</pre> | ||
|
||
<p> </p> | ||
|
||
<p>Table: <code>Transactions</code></p> | ||
|
||
<pre> | ||
+----------------+---------+ | ||
| Column Name | Type | | ||
+----------------+---------+ | ||
| transaction_id | int | | ||
| visit_id | int | | ||
| amount | int | | ||
+----------------+---------+ | ||
transaction_id is column with unique values for this table. | ||
This table contains information about the transactions made during the visit_id. | ||
</pre> | ||
|
||
<p> </p> | ||
|
||
<p>Write a solution to find the IDs of the users who visited without making any transactions and the number of times they made these types of visits.</p> | ||
|
||
<p>Return the result table sorted in <strong>any order</strong>.</p> | ||
|
||
<p>The result format is in the following example.</p> | ||
|
||
<p> </p> | ||
<p><strong class="example">Example 1:</strong></p> | ||
|
||
<pre> | ||
<strong>Input:</strong> | ||
Visits | ||
+----------+-------------+ | ||
| visit_id | customer_id | | ||
+----------+-------------+ | ||
| 1 | 23 | | ||
| 2 | 9 | | ||
| 4 | 30 | | ||
| 5 | 54 | | ||
| 6 | 96 | | ||
| 7 | 54 | | ||
| 8 | 54 | | ||
+----------+-------------+ | ||
Transactions | ||
+----------------+----------+--------+ | ||
| transaction_id | visit_id | amount | | ||
+----------------+----------+--------+ | ||
| 2 | 5 | 310 | | ||
| 3 | 5 | 300 | | ||
| 9 | 5 | 200 | | ||
| 12 | 1 | 910 | | ||
| 13 | 2 | 970 | | ||
+----------------+----------+--------+ | ||
<strong>Output:</strong> | ||
+-------------+----------------+ | ||
| customer_id | count_no_trans | | ||
+-------------+----------------+ | ||
| 54 | 2 | | ||
| 30 | 1 | | ||
| 96 | 1 | | ||
+-------------+----------------+ | ||
<strong>Explanation:</strong> | ||
Customer with id = 23 visited the mall once and made one transaction during the visit with id = 12. | ||
Customer with id = 9 visited the mall once and made one transaction during the visit with id = 13. | ||
Customer with id = 30 visited the mall once and did not make any transactions. | ||
Customer with id = 54 visited the mall three times. During 2 visits they did not make any transactions, and during one visit they made 3 transactions. | ||
Customer with id = 96 visited the mall once and did not make any transactions. | ||
As we can see, users with IDs 30 and 96 visited the mall one time without making any transactions. Also, user 54 visited the mall twice and did not make any transactions. | ||
</pre> |