Back to Browse

Grand Slam Titles | Advanced SQL Interview Questions | Data Engineer Interview Question | FAANG SQL

107 views
Aug 13, 2024
19:38

Video 355: This is the 34th video of the SQL Interview Question series. 00:00 - Introduction to dataset and Question 02:35 - Approach 1: Brute Force Method 08:45 - Approach 2: Optimal Solution 12:40 - Approach 3: Single Table Call 18:10 - Conclusion We are given two tables, Players and Championships In Players table, it contains the name and the ID of a tennis player player_id is the primary key for this table. its like a lookup of the Player name, if we have the player_id In the Championships table, it contains the IDs of the players who won one each tennis tournament of the grand slam for the year 2018, 19 and 20 we are asked to write a solution to report the number of grand slam tournaments won by each player. Do not include the players who did not win any tournament. In this video, we explore three different SQL approaches to count the number of Grand Slam tournaments won by each tennis player. *** Approach 1: Brute Force Method *** This method involves explicitly counting the wins by querying each Grand Slam tournament separately and then unifying the results. It’s straightforward and provides clarity on how each tournament contributes to the total count. *** Approach 2: Optimal Solution *** In this approach, we optimize the process by unifying the data across all tournaments first and then performing the counting operation. This reduces redundancy and improves query efficiency. *** Approach 3: Single Table Call *** Here, we demonstrate an approach that calls the Championships table just once. By using conditional aggregation, we calculate the total number of Grand Slam wins for each player, providing a clean and efficient solution. Each approach has its strengths and is suited to different scenarios, whether you’re prioritizing clarity, performance, or simplicity. For a comprehensive understanding of these SQL methodologies and their application, please refer to this explanatory video. code: https://github.com/jeganpillai/adv_sql_50_questions/blob/main/adv50_34_grand_slam_titles.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 TheWide : https://thewide.com/profile/891 #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

Download

1 formats

Video Formats

360pmp433.1 MB

Right-click 'Download' and select 'Save Link As' if the file opens in a new tab.

Grand Slam Titles | Advanced SQL Interview Questions | Data Engineer Interview Question | FAANG SQL | NatokHD