logo

Back to questions

Page With No Likes

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
namevarchar

Example Input:

page_idname
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.

PostgreSQL 14

Refer friends to get bonus content & cool prizes.