Lets write a SQL Query for page recommendation.
The pages are to be recommended to a user if any of his friends like that page.
If the user already likes the page, then it should not be recommended.
Problem Statement -
Write an SQL query that makes recommendations using the pages that your friends liked. Assume you have two tables: a two-column table of users and their friends, and a two-column table of users and the pages they liked. It should not recommend pages you already like.
Practice Data -
Tables -
User Friends and Pagelikes
DDL Script
CREATE table Pagelikes
(
userid int not null,
pageid int not null
);
CREATE table User_friends
(
userid int not null,
friendid int not null
);
Insert into Pagelikes VALUES
(1, 11), (1, 12),
(2, 11), (2, 33),
(3, 15), (3, 12),
(3, 11), (4, 44);
Insert into User_friends VALUES
(1, 2),
(1, 3),
(1, 4),
(2, 3),
(3, 4),
(4, 2);