SQL Playground
TutorialsPlayground
SQL FormatterSQL MinifierSyntax ValidatorJSON to SQLCSV to SQLSQL to JSONER Diagram Generator
Daily ChallengeInterviewsCheat SheetBlog

© 2026 SQL Playground. Built for developers.

PrivacyTermsAboutRSS Feed
SQL Playground
TutorialsPlayground
SQL FormatterSQL MinifierSyntax ValidatorJSON to SQLCSV to SQLSQL to JSONER Diagram Generator
Daily ChallengeInterviewsCheat SheetBlog
Back to Pool
Snowflake

Page Recommendations

Write a query to recommend pages to a user. A page should be recommended if it is liked by at least one friend of the user, but not already liked by the user themselves.

Schema

SQL Editor
Loading...

Execution Result

Write and run your query to see results here.

Problem Context & Learning

💡Why This Question Matters

This social network recommendation problem is common in Snowflake interviews, testing your ability to work with graph-like data structures using SQL. Recommendation systems are at the heart of modern applications, and this question assesses whether you can translate the logic 'friends of friends' or 'what my friends like that I don't' into efficient SQL. The key challenge is coordinating multiple filtering conditions across different relationships.

🔑Key SQL Concepts

Concepts tested: JOIN operations across relationship tables, subqueries with IN clause for filtering, DISTINCT to remove duplicate recommendations, understanding friend graphs in relational databases, and set difference operations (what friends like MINUS what user likes). Alternative approaches include EXCEPT or NOT EXISTS for the exclusion logic.

🌍Real-World Applications

Snowflake customers use similar queries to: build collaborative filtering recommendation engines, generate 'people you may know' features in social networks, create content discovery systems based on peer behavior, identify cross-sell opportunities by analyzing what similar customers purchased, and power email campaigns with personalized suggestions based on network activity.

Interview Insights & Approach

Strategic Approach

When tackling this Snowflake problem, the key is to understand the grain of the result. Are you returning one row per user, or one row per category? Always start by identifying your unique join keys and consider if filtered aggregations (CASE WHEN) are more efficient than multiple subqueries.

Common Pitfalls

Be careful with NULL values in your JOIN conditions or aggregate functions. In interview scenarios, datasets often include edge cases like zero-count categories or duplicate entries that can throw off a simple COUNT(*) if not handled with DISTINCT.

Discussion & Solutions

Share your approach, optimized queries, or ask questions. Learning from others is the fastest way to master SQL.

💬 Join the conversation below

Comments

© 2026 SQL Playground. Built for developers.

PrivacyTermsAboutRSS Feed