SQL
Write a SQL query for the average transaction amount for customers who have made more than 10 purchases in the last 90 days.
Data Scientist
Dropbox
Snap
Netflix
Square
Zalando
Expedia
Answers
Anonymous
5 months ago
SELECT customer_id,
AVG(transaction_amount) AS avg_transaction_amount
FROM transactions WHERE transaction_date >= CURRENT_DATE - INTERVAL '90 days'
GROUP BY customer_id
HAVING COUNT(transaction_id) > 10;
Interview question asked to Data Scientists interviewing at Discord, Tesla, Square and others: Write a SQL query for the average transaction amount for customers who have made more than 10 purchases in the last 90 days..