We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7c375a2 commit cabc5cfCopy full SHA for cabc5cf
Medium/Page Recommnedations.sql
@@ -101,4 +101,21 @@ select distinct page_id from pages_liked
101
where page_id not in (select page_id from likes where user_id = 1);
102
103
104
+Prac sol: - I have to execute this
105
+
106
+with user1_friends as (
107
+select user1_id as user, user2_id friend from friendship where user1_id = 1
108
+union
109
+select user2_id, user1_id from friendship where user2_id = 1
110
+), pages_liked as (
111
+select f.friend, l.page_id
112
+from user1_friends f inner join likes l on f.friend = l.user_id
113
+)
114
+select distinct a.page_id
115
+from pages_liked a left join (select * from likes where user_id = 1) b on a.page_id = b.page_id
116
+where b.user_id is null
117
118
119
120
121
0 commit comments