DEV Community

Cover image for SQL πŸ“Š challenge_2βš”οΈ
Mahmoud EL-kariouny
Mahmoud EL-kariouny

Posted on

SQL πŸ“Š challenge_2βš”οΈ

Page With No Likes Facebook SQL Interview Question

  • Assume you're given two tables containing data about Facebook Pages and their respective likes (as in "Like a Facebook Page").
  • Write a query to return the IDs of the Facebook pages that have zero likes.
  • The output should be sorted in ascending order based on the page IDs.

⚠️Note:

  • You have to visit the task URL to fully understand what the task needs if you want to add a solution or test your solution.
Task URL: Link

My Solution:

SELECT 
    p.page_id 
FROM
    pages p 
LEFT JOIN 
    page_likes l
ON
    p.page_id = l.page_id
GROUP BY 
    p.page_id
HAVING
    COUNT(l.page_id) = 0;
Enter fullscreen mode Exit fullscreen mode

Code Snapshot:

Image description

My Problem πŸ’‘ Solving Repo: Link

Learn SQL πŸ“Š

SQL πŸ”₯ Get Expertise in SQL with These Top Free CoursesπŸ’―πŸ†

πŸŽ₯

Connect with Me 😊

πŸ”— Links

linkedin

twitter

Image of Datadog

The Future of AI, LLMs, and Observability on Google Cloud

Datadog sat down with Google’s Director of AI to discuss the current and future states of AI, ML, and LLMs on Google Cloud. Discover 7 key insights for technical leaders, covering everything from upskilling teams to observability best practices

Learn More

Top comments (0)

The Most Contextual AI Development Assistant

Pieces.app image

Our centralized storage agent works on-device, unifying various developer tools to proactively capture and enrich useful materials, streamline collaboration, and solve complex problems through a contextual understanding of your unique workflow.

πŸ‘₯ Ideal for solo developers, teams, and cross-company projects

Learn more

πŸ‘‹ Kindness is contagious

Please leave a ❀️ or a friendly comment on this post if you found it helpful!

Okay