Загрузка...

Coding Series - SQL : User With Most Friends | SQL Interview | Data Engineer Interview Questions

Video 167: This is the 41st video in our series "Crack SQL Interview in 50 Questions," and in this exercise, we explore the topic of "Sub Queries"

In this YouTube video, we dive into a fascinating problem using social media data represented in the RequestAccepted table. This dataset captures user interactions, specifically friend requests sent and received. Our task is to identify the user with the most friends and the number of friends they have.

Initially, we approach the problem by simply counting the number of friends each user has using SQL. However, we quickly realize that this method overlooks two critical factors.

Firstly, what if multiple users have the same number of friends? To address this, we employ a SQL query to find all users with the maximum number of friends.

Secondly, upon closer examination of the data, we notice a discrepancy in the friend count. When a user accepts a friend request, both the requester and the accepter gain a new friend. To accommodate this logic, we need to adjust our SQL query accordingly.

To tackle these challenges, we break down our approach step by step. We demonstrate how to aggregate the dataset at the user level, ensuring that both requesters and accepters are accounted for correctly. By refining our SQL query, we successfully identify the user with the most friends.

For a comprehensive understanding of these SQL methodologies and their application, please refer to this explanatory video.

code: https://github.com/jeganpillai/crack_sql_interview_in_50_questions/blob/main/seq01_41_user_with_most_friends.sql

Follow me on,
Website : https://growwithdata.co/
YouTube : https://www.youtube.com/@growwithdata
TikTok : https://www.tiktok.com/@growwithdata
LinkedIn : https://www.linkedin.com/company/growwithdata/
Facebook : https://www.facebook.com/growwithdata.co/
FB Group : facebook.com/groups/datainterviewpreparation
twitter : https://twitter.com/growwithdata_co
Instagram : https://www.instagram.com/growwithdata.co/
WhatsApp : https://whatsapp.com/channel/0029VaF8pkb77qVNfbp5pA0S

#sql #dataengineers #tablejoins #ceil #floor #bucket #meta #google #facebook #apple #paypal #netflix #amazon #deinterview #sqlinterview #interviewquestions #leetcode #faang #maanga #mysql #oracle #dbms #query #sqlserver #mysql #coderpad #aggregates #aggregation #nonaggregation #database #placementpreparation #lead #lag #windowsfunction #nullcheck #coalesce #sqlperformance #ifnull #case #lead #lag #windowsfunction #tamil #tamilpython #tamilinterview #tamilinterviewlatest #tamilinterviewquestions #sqlintamil

Видео Coding Series - SQL : User With Most Friends | SQL Interview | Data Engineer Interview Questions канала Grow with Data
Яндекс.Метрика
Все заметки Новая заметка Страницу в заметки
Страницу в закладки Мои закладки
На информационно-развлекательном портале SALDA.WS применяются cookie-файлы. Нажимая кнопку Принять, вы подтверждаете свое согласие на их использование.
О CookiesНапомнить позжеПринять