AnalystPath

Page Recommendations via Friends' Likes

SQLHardSenior levelMeta~15 min

Problem

**[Asked at Meta]**

Recommend pages to users: pages a user's **friends have liked** but the user has **not liked**.

Return `user_id` and `recommended_page`, ordered by user then page.

Tables

Example rows — the live problem includes the full dataset.

friendships
user_idfriend_id
page_likes
user_idpage_id

Expected output

Your answer should return 5 rows with the columns user_id, recommended_page.

Starter code (SQL)

SELECT *
FROM friendships;

Solve this SQL question free

Write SQL and run it instantly in your browser — even on your phone. No signup needed to try.

Solution & explanation

Create a free account to unlock the optimal solution, a step-by-step explanation, and the hidden test cases that grade your answer.

Sign up free to unlock

Related SQL questions