logo

Back to questions

Page With No Likes [Facebook SQL Interview Question]

Easy

Assume you're given the tables below about Facebook Page and Page likes (as in "Like a Facebook Page").

Write a query to return the IDs of the Facebook pages which do not possess any likes. The output should be sorted 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

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

PostgreSQL 14