Power Creators (Part 1) — SQL Question Asked By LinkedIn

Solving SQL Question asked by LinkedIn

Suraj Mishra

--

Originally Published in https://asyncq.com/

Photo by Caspar Camille Rubin on Unsplash

Introduction

  • In this article we will solve Power Creators (Part 1) SQL question which is asked by LinkedIn as per DataLemur website.

If you don’t know DatLemur then please do visit , it’s one of the best website to practice SQL questions and improve your SQL skills.

Question

  • We have been given personal_profile pages and company pages.
  • If someone’s personal profile has more followers than company they work for then they are power creators.
  • We need to return the ID’s of such power creator.
  • As we can see below profile_id has personal followers more than company followers.

Solution

  • At first we can see that there are two tables company_page and profile_page. we can see that both the table are connected with employer_id and company_id.
  • So we can use this relation to our advantage and join these two tables to get the final base table ready for querying the output.
  • Each profile now has company info along with it. we can see for profile id 1 , followers 92k and company followers are 200. So this user would be power creator.
  • Now all we have to do is to…

--

--