logo

Back to questions

Page With No Likes [Facebook SQL Interview Question]

Easy

Assume you are given the tables below about Facebook pages and page likes. Write a query to return the page IDs of all the Facebook pages that don't have any likes. The output should be in ascending order.

Table:

Column NameType
page_idinteger
page_namevarchar

Example Input:

page_idpage_name
20001SQL Solutions
20045Brain Exercises
20701Tips for Data Analysts

Table:

Column NameType
user_idinteger
page_idinteger
liked_datedatetime

Example Input:

user_idpage_idliked_date
1112000104/08/2022 00:00:00
1212004503/12/2022 00:00:00
1562000107/25/2022 00:00:00

Example Output:

page_id
20701

Explanation: The page with ID 20701 has no likes.

The dataset you are querying against may have different input & output - this is just an example!

PostgreSQL 14