Back to problems

Write SQL for first share and closest collaborator

SQL · Figma · Hard

Consider event records for views of design files. You have two tables: files(file_id, creator_id) stores the creator for each design file. creator_id is a VARCHAR identifier. file_views(file_id, user_id, viewed_at) stores every file-open event. user_id is an INTEGER identifier, and viewed_at is the time when the viewer opened the file. A file share is inferred whenever the viewer is not the file's creator. Because creator_id is text while user_id is integer, any comparison…

Checking your access…