Back to problems

Compute same-day acceptance metrics last week

SQL · Snapchat · Medium

You are working with two tables that store UTC timestamps: users(user_id INT PRIMARY KEY, spam BOOLEAN) friendships(requester_id INT, addressee_id INT, requested_at TIMESTAMP, approved_at TIMESTAMP NULL) A friendship request is recorded in friendships when it is created (requested_at) and, if it is later accepted, the acceptance moment is stored in approved_at; when a request has not been accepted yet, approved_at is NULL. A user may or may not appear in users; a spam value…

Checking your access…