1724. Customer Who Visited but Did Not Make Any Transactions
My accepted SQL solution to LeetCode problem 1724, Customer Who Visited but Did Not Make Any Transactions, running in 1210ms.
- Difficulty: Easy
- SQL
- Runtime 1210ms
- Memory 0.0B
- Updated
Read the problem on LeetCode View on GitHub
The problem statement is LeetCode’s and stays on their site. What follows is my accepted solution.
SQL
Accepted on LeetCode — runtime 1210ms, memory 0.0B, accepted 2025-12-31.
SELECT v.customer_id, COUNT(v.visit_id) AS count_no_trans
FROM Visits v
LEFT JOIN Transactions t ON v.visit_id = t.visit_id
WHERE t.transaction_id IS NULL
GROUP BY v.customer_id