Practice Customer Who Visited but Did Not Make Any Transactions
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
Tables: Visits(visit_id INT, customer_id INT); Transactions(transaction_id INT, visit_id INT, amount INT). Visits.visit_id and Transactions.transaction_id are unique. Transactions.visit_id identifies the visit associated with a transaction. Return customer_id and count_no_trans for customers having visits with no transaction. Count qualifying visits, not customers or transaction rows; a customer may have both paying and nonpaying visits. Output order is unrestricted.
Source: Customer Who Visited but Did Not Make Any Transactions on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
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 | +----------------+----------+--------+
+-------------+----------------+ | customer_id | count_no_trans | +-------------+----------------+ | 54 | 2 | | 30 | 1 | | 96 | 1 | +-------------+----------------+
Related LeetCode Problems
Practice more problems similar to Customer Who Visited but Did Not Make Any Transactions.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.