ALL Hackerrank SQL Solutions in ONE Video! | Easy Medium Hard Problems

แชร์
ฝัง
  • เผยแพร่เมื่อ 13 ธ.ค. 2024

ความคิดเห็น • 139

  • @alexmyers3716
    @alexmyers3716 2 ปีที่แล้ว +64

    00:00:00 Intro
    00:00:29 Revising the Select Query I (Easy)
    00:02:00 Revising the Select Query II (Easy)
    00:02:57 Select All (Easy)
    00:03:14 Select By ID (Easy)
    00:03:37 Japanese Cities' Attributes (Easy)
    00:04:08 Japanese Cities' Names (Easy)
    00:04:40 Weather Observation Station 1 (Easy)
    00:05:05 Weather Observation Station 3 (Easy)
    00:07:15 Weather Observation Station 4 (Easy)
    00:08:03 Weather Observation Station 6 (Easy)
    00:08:53 Weather Observation Station 7 (Easy)
    00:09:59 Weather Observation Station 8 (Easy)
    00:12:24 Weather Observation Station 9 (Easy)
    00:13:32 Weather Observation Station 10 (Easy)
    00:14:41 Weather Observation Station 11 (Easy)
    00:16:46 Weather Observation Station 12 (Easy)
    00:19:14 Higher Than 75 Marks (Easy)
    00:21:20 Employee Names (Easy)
    00:21:55 Employee Salaries (Easy)
    00:23:01 Type of Triangle (Easy)
    00:31:29 The PADS (Medium)
    00:40:56 Revising Aggregations - The Count Function (Easy)
    00:41:42 Revising Aggregations - The Sum Function (Easy)
    00:43:29 Revising Aggregations - Averages (Easy)
    00:44:02 Average Population (Easy)
    00:44:52 Japan Population (Easy)
    00:45:18 Population Density Difference (Easy)
    00:45:52 Top Earners (Easy)
    00:50:01 Weather Observation Station 2 (Easy)
    00:53:01 Weather Observation Station 13 (Easy)
    00:54:50 Weather Observation Station 14 (Easy)
    00:56:06 Weather Observation Station 15 (Easy)
    01:02:18 Weather Observation Station 16 (Easy)
    01:03:27 Weather Observation Station 17 (Easy)
    01:07:16 Weather Observation Station 18 (Easy)
    01:12:31 Weather Observation Station 19 (Easy)
    01:20:50 Population Census (Easy)
    01:23:26 African Cities (Easy)
    01:24:27 Average Population of Each Continent (Easy)
    01:26:48 The Blunder (Easy)
    01:34:06 Weather Observation Station 5 (Easy)
    01:41:04 Draw The Triangle 1 (Easy)
    01:47:38 Draw The Triangle 2 (Easy)
    01:49:19 The PADS (Medium)
    02:01:22 Binary Tree Nodes (Medium)
    02:24:39 New Companies (Medium)
    02:44:00 Weather Observation Station 20 (Medium)
    02:53:10 The Report (Medium)
    03:07:44 Top Competitors (Medium)
    03:27:03 Ollivander's Inventory (Medium)
    03:48:14 Challenges (Medium)
    04:05:32 Contest Leaderboard (Medium)
    04:22:56 SQL Project Planning (Medium)
    04:44:49 Placements (Medium)
    05:11:08 Symmetric Pairs (Medium)
    05:27:39 Print Prime Numbers (Medium)
    05:47:21 Interviews (Hard)
    06:39:06 15 Days of Learning SQL (Hard)

    • @werka_z
      @werka_z ปีที่แล้ว

      thank you!

    • @ronakvadher9977
      @ronakvadher9977 6 หลายเดือนก่อน

      Is there any way to solve it again

  • @ashrafabdo5461
    @ashrafabdo5461 2 ปีที่แล้ว +5

    9:48 ending with vowels
    select distinct city
    from station
    where right (city,1) in('a','e','i','o','u');
    Is better Seloution

  • @thanhvyho2195
    @thanhvyho2195 2 ปีที่แล้ว +35

    this video should have 1M+ views! thanks a bunch for your effort, really helpful for sql learners

    • @thecodingmentor7701
      @thecodingmentor7701  2 ปีที่แล้ว +2

      Thanks thats very kind of you! Spread the word and we will get 1M Views! :)

    • @trihua5296
      @trihua5296 2 ปีที่แล้ว

      bạn đang học ở đâu vậy, có thể giúp mình học sql không

  • @anonyousperson1672
    @anonyousperson1672 11 หลายเดือนก่อน +5

    Thank you so much for your tutorial! It's been a life saver for me.
    Sharing my solution to Binary Treed Nodes 02:01:22 which may be slightly easier
    SELECT
    N,
    CASE WHEN P IS NULL THEN 'Root'
    WHEN N IN (SELECT P FROM BST) THEN 'Inner'
    ELSE 'Leaf' END
    FROM BST
    ORDER BY 1

    • @thecodingmentor7701
      @thecodingmentor7701  8 หลายเดือนก่อน

      Thank you for adding your solution and helping us learn! Cheers

    • @Amber-rh8dh
      @Amber-rh8dh 3 หลายเดือนก่อน

      TYSMMMM!!!!!!

  • @gazanfersayed4870
    @gazanfersayed4870 8 หลายเดือนก่อน

    Hey! This video has been such a life saver. Thank you!!
    Also, for the last challenge i.e. 06:39:06 15 days of learning SQL, you can skip the @count_hacker variable by just doing the count in the @consistent_hacker variable while joining it with the max_hacker CTE. Like this:
    declare @consistent_hackers table
    (
    submission_date date,
    hacker_id int
    );
    declare @sub_date date;
    declare @remaining_date date;
    insert into @consistent_hackers
    select submission_date, hacker_id
    from submissions
    where submission_date = '2016-03-01';
    set @sub_date = '2016-03-01';
    set @remaining_date = '2016-03-01';
    while @sub_date

    • @thecodingmentor7701
      @thecodingmentor7701  8 หลายเดือนก่อน

      Hey! Thanks for enriching my post with your great addition!

  • @bigshot_07
    @bigshot_07 ปีที่แล้ว +2

    my approach : For odd number median -> quants = 0.5 i.e. 1st and last number / 2.
    so in this case,
    we are taking min(LAT_N) + max(LAT_N)/2 (do in calculator)
    ans: 85.03...
    round(85.03..,4)
    where 4 means round to 4 decimal places. then - 1.13999455
    Wolla!
    weather station 20.

  • @ashrafabdo5461
    @ashrafabdo5461 2 ปีที่แล้ว

    1:01:55
    select round(long_w,4)
    from station
    where lat_n=(select max(lat_n)from station
    where lat_n

  • @davestorm6718
    @davestorm6718 7 หลายเดือนก่อน +2

    For Binary Tree Nodes, try this instead:
    SELECT N, CASE
    WHEN P IS NULL THEN 'Root'
    WHEN N IN (SELECT P FROM BST) THEN 'Inner'
    ELSE 'Leaf' END
    FROM BST ORDER BY N;

  • @ashrafabdo5461
    @ashrafabdo5461 2 ปีที่แล้ว +1

    10:43
    select distinct city
    from station
    where right (city,1) in('a','e','i','o','u')
    and left(city,1) in('a','e','i','o','u');

    • @thecodingmentor7701
      @thecodingmentor7701  2 ปีที่แล้ว +2

      Hey Ashraf, that's a great Solution. Thank you for sharing!

  • @ashrafabdo5461
    @ashrafabdo5461 2 ปีที่แล้ว

    1:04:54
    select round(long_w,4) from station
    where
    lat_n=(select min(lat_n)from station
    where lat_n>38.7780);

  • @aditijaitly2844
    @aditijaitly2844 ปีที่แล้ว +4

    This is such an amazing video , great explanation , deserves much more appreciation !!!

  • @ashrafabdo5461
    @ashrafabdo5461 2 ปีที่แล้ว

    50:02
    select max(months * salary), count( *)
    from Employee
    where (months * salary) =
    (select max(months * salary) from Employee);

    • @aryakaagnihotri3210
      @aryakaagnihotri3210 ปีที่แล้ว

      this is what i thought but it does not pass the test case , are you having the same problem also ?

  • @parthagheda
    @parthagheda 2 ปีที่แล้ว +11

    Thank You So Very Much, Your efforts have helped me a lot. Please never remove this video, haha. I truly wish The Best for you in Life. Stay Blessed.

    • @thecodingmentor7701
      @thecodingmentor7701  2 ปีที่แล้ว +6

      Thanks so much for your kind words! No I will not remove it, keep going, you are amazing!

  • @Victor-yn6lv
    @Victor-yn6lv ปีที่แล้ว +5

    You are really a SQL genius. Thank you for your video. You are much better than the SQL teacher that I paid for.

    • @thecodingmentor7701
      @thecodingmentor7701  8 หลายเดือนก่อน

      Thanks! Im glad you could get value out of my content!

  • @karangupta_DE
    @karangupta_DE 2 ปีที่แล้ว +1

    thank you so much, you just activated sql god mode :)

  • @sw8tanya
    @sw8tanya 2 ปีที่แล้ว +5

    This is amazing, appreciate all the detailed explanation of the problems and their solution. This is super helpful in learning and practicing!

    • @thecodingmentor7701
      @thecodingmentor7701  8 หลายเดือนก่อน

      Thank you! It took a ton of time to record all of this so Im glad you like it!

  • @victor_peral
    @victor_peral ปีที่แล้ว +1

    This is a gem 💎
    Thank you

  • @shaikusman536
    @shaikusman536 ปีที่แล้ว +2

    Awsome brother....You are just amazin gbro.....Loved yout teaching style......Hats off to your dedication & commitment.....Thanks a ton .....respect from bangalore,INDIA.

    • @thecodingmentor7701
      @thecodingmentor7701  8 หลายเดือนก่อน

      Thank you! Love my viewers from India! Keep learning :)

  • @terran008
    @terran008 8 หลายเดือนก่อน

    This is great man, thank you a lot for taking your time for this and sharing it with us

  • @Ajjayy4444
    @Ajjayy4444 4 หลายเดือนก่อน

    U re not the bro that i deserve but the bro that I need ! !

  • @carolrockk
    @carolrockk 9 หลายเดือนก่อน

    Really helpful! Thanks!

  • @madhuhanumantu8080
    @madhuhanumantu8080 ปีที่แล้ว

    Thanks so much for sharing approach and solution. Appreciate your efforts .

  • @Victor-yn6lv
    @Victor-yn6lv 2 ปีที่แล้ว

    Thank you so much for sharing the solutions to the SQL questions in Hackerrank!!!!

  • @modalediamond5280
    @modalediamond5280 2 ปีที่แล้ว

    Wow! This is amazing, just heard of this for first time. You got my sub.

  • @gayathrivelmurugan6148
    @gayathrivelmurugan6148 ปีที่แล้ว +1

    Thank you, bro, very clear explanation and l loved the way you teach ... Very thankful for your effort

  • @SeanzySmooth
    @SeanzySmooth 8 หลายเดือนก่อน

    Awesome video and thank you for putting the timestamp for each problem in the comments

    • @thecodingmentor7701
      @thecodingmentor7701  8 หลายเดือนก่อน

      Thanks for appreciating it! Timestamps make sense, I dont think anyone would want to watch the whole thing at once 😁

  • @trihua5296
    @trihua5296 2 ปีที่แล้ว

    Thank you so much, the Hard problem it's very very hard but you're work so smooth, clever man!

  • @AmanBkumarvlogs3375
    @AmanBkumarvlogs3375 ปีที่แล้ว

    Hello Sir,
    I am from India and I love your work and your quires explanation is so amazing .😊😊😊

    • @thecodingmentor7701
      @thecodingmentor7701  ปีที่แล้ว

      Thanks Kumar! Im glad it can help you and its nice to see that so many people from India like to watch my explanations 😀

  • @sudeep246
    @sudeep246 ปีที่แล้ว

    thank you so much......god bless you....i was looking these Kind of explanation all over the TH-cam

    • @thecodingmentor7701
      @thecodingmentor7701  8 หลายเดือนก่อน

      You're welcome. Glad I could help you out!

  • @davidfuentes7806
    @davidfuentes7806 2 ปีที่แล้ว +2

    Thank you so much!! You saved me!

  • @mennahtamally2821
    @mennahtamally2821 4 หลายเดือนก่อน

    thank you so much for your time and effort wish you all the success in your life as this is very kind of you

  • @paakwesiblankson7884
    @paakwesiblankson7884 ปีที่แล้ว

    Thanks for this great work!!!

  • @sidharthadaggubati438
    @sidharthadaggubati438 2 ปีที่แล้ว +2

    @4:23:40 the problem description doesn’t say about start date. It says about the end dates being consecutive.

    • @thecodingmentor7701
      @thecodingmentor7701  2 ปีที่แล้ว

      Hi Sidharta, you are right, it doesnt say about start date. However if the end dates are consecutive, that also means that the end date of one record is the start date of the next record.

    • @sidharthadaggubati438
      @sidharthadaggubati438 2 ปีที่แล้ว

      @@thecodingmentor7701 you're right. I forgot that the gap between start and end dates is exactly one for each row.
      Is there any alternative solution you can think of for this problem?
      I have started with lag/lead to find out the "days difference" between two tasks and thought of ranking them somehow. Any thoughts?
      Thanks for your reply. Your solutions are awesome

  • @Livefree103
    @Livefree103 ปีที่แล้ว

    thankyou so much for these amazing videos. hope to learn more on SQL

    • @thecodingmentor7701
      @thecodingmentor7701  8 หลายเดือนก่อน

      you are most welcome! You will surely learn more, just keep trying :)

  • @aakiffpanjwani1089
    @aakiffpanjwani1089 10 หลายเดือนก่อน

    really helpful, thank you for this video !!!

  • @himanikumar7979
    @himanikumar7979 2 ปีที่แล้ว

    Very Resourceful! Thanks a ton!!😊

  • @DataVisionary
    @DataVisionary 2 ปีที่แล้ว

    Thank you so much. I appreciate your work.
    Keep up the Work with SQL . I am gonna be your true follower.
    💯

  • @chaitanyagawade9663
    @chaitanyagawade9663 ปีที่แล้ว

    Thanks a Lot Sir!

  • @unuboldenkhsaruul8682
    @unuboldenkhsaruul8682 2 ปีที่แล้ว

    Thanks man appreciate it keep up the good work! looking forward more videos

    • @thecodingmentor7701
      @thecodingmentor7701  8 หลายเดือนก่อน +1

      Thanks! I kind of ran out of SQL Challenges to solve after this video, but Im trying to come up with different ideas

    • @unuboldenkhsaruul8682
      @unuboldenkhsaruul8682 8 หลายเดือนก่อน

      @@thecodingmentor7701 any idea about job hunting lol?

  • @quillerj2412
    @quillerj2412 8 หลายเดือนก่อน

    Thank you very much!

  • @a2011q
    @a2011q ปีที่แล้ว

    thank you bro, very useful video

  • @ComputationalArt
    @ComputationalArt 2 ปีที่แล้ว

    Good Job Man!, but You forgot "Weather Observation Station 5", the solution:
    SELECT CITY, LENGTH(CITY) FROM STATION
    ORDER BY LENGTH(CITY), CITY
    LIMIT 1;
    SELECT CITY, LENGTH(CITY) FROM STATION
    ORDER BY LENGTH(CITY) DESC, CITY
    LIMIT 1;

    • @Shivam-nr1si
      @Shivam-nr1si ปีที่แล้ว

      this doesn't work in Mysql

  • @Sam_tuunes
    @Sam_tuunes 2 ปีที่แล้ว +1

    Sir please make a video on Data lemur all questions

  • @gabrielmoffa
    @gabrielmoffa 11 หลายเดือนก่อน

    Thank you a lot, appreciated it very much

    • @thecodingmentor7701
      @thecodingmentor7701  8 หลายเดือนก่อน +1

      You are welcome Gabriel! Glad that it helped!

  • @GM-xz4xc
    @GM-xz4xc ปีที่แล้ว

    God bless you

  • @ianpropst-campbell6028
    @ianpropst-campbell6028 2 ปีที่แล้ว

    Wow what a great resource! I don't see the "Occupations" problem though. Have you done a video for that one?

  • @nikitasinha8181
    @nikitasinha8181 ปีที่แล้ว

    Thank you so much sir

  • @rayyanamir8560
    @rayyanamir8560 2 ปีที่แล้ว

    Thanks a lot sir. ;)

  • @Manjunath_pai
    @Manjunath_pai 2 ปีที่แล้ว

    Looking at this video Interviewer will be like you are Hired 😊

  • @diftq8191
    @diftq8191 2 ปีที่แล้ว +1

    youre a god

  • @raktimmazumdar5794
    @raktimmazumdar5794 ปีที่แล้ว

    Great video. Thank you so much for explaining so beautifully.

    • @thecodingmentor7701
      @thecodingmentor7701  8 หลายเดือนก่อน +1

      Thanks for your comment! Glad u liked it

  • @AnandKumar-dc2bf
    @AnandKumar-dc2bf 2 ปีที่แล้ว

    Thanks Mate

  • @melanibruce3755
    @melanibruce3755 2 ปีที่แล้ว

    thank u so much, this is amaizing

  • @Gonza2432
    @Gonza2432 2 ปีที่แล้ว

    Thank you bro!

  • @Nothing-hf8uj
    @Nothing-hf8uj 2 ปีที่แล้ว

    that BETWEEEN 🤣 3:01:54

  • @abhay-zw3yw
    @abhay-zw3yw 2 ปีที่แล้ว

    THANKS

  • @mickyman753
    @mickyman753 2 ปีที่แล้ว +1

    Is the questions showed in the video are in order we should solve them , like next question would be upgrade or follow up question previous to it? Also I have placements in few weeks ,so I wanted to prepare Sql enough to clear my onine assesment and interview , so are these 58 questions enough to prepare me?

    • @thecodingmentor7701
      @thecodingmentor7701  2 ปีที่แล้ว +3

      Hi Mayank, no they are not in a specific order. Of course its good to first solve easier and then harder questions. These questions will prepare you well for the interview. The only addition is to look up Data Modelling like Entity Relationship Model. These questions are not covering that, good Luck on the interview!

    • @mickyman753
      @mickyman753 2 ปีที่แล้ว +1

      @@thecodingmentor7701 will do and thanks for the amazing content and if you can , please make a cheat sheet kinda video for SQL for frequently asked patterns for SQL queries questions, I searched a lot on TH-cam and Google ,but didn't find anything good , given that almost every IT fresher job aspirant prepares SQL and there's such less worthy content is surprising, so if you can it would be a huge help to me and other future learners too , in the meantime I'll try to complete your video and practice

  • @989894945
    @989894945 6 หลายเดือนก่อน

    Thanks!

    • @thecodingmentor7701
      @thecodingmentor7701  6 หลายเดือนก่อน

      Thank you!! It is very much appreciated 🙏👏

  • @dbatexas
    @dbatexas 2 ปีที่แล้ว

    can you post hierarchy query like finding manager, employe hierarchy. thank you for all help!

  • @mayurijoshiofficial
    @mayurijoshiofficial 10 หลายเดือนก่อน

    Do you have solution for Advertising Sytem Net Seller Report?
    And Transaction Monitoring System Report

    • @thecodingmentor7701
      @thecodingmentor7701  8 หลายเดือนก่อน

      Are these from the hackerrank certifications? I don't recall, but I also have videos on the hackerrank certifications. You should check them out

  • @karthikdnd
    @karthikdnd ปีที่แล้ว

    I don't understand how this logic worked in the project planning medium question because, for task IDs 10, 15, and 11, the start dates are listed in the end date column.

  • @hackerutkarsh
    @hackerutkarsh 2 ปีที่แล้ว

    2:25:57 new companies, can't understand this solution at all, can you please explain it? thanks in advance

    • @thecodingmentor7701
      @thecodingmentor7701  2 ปีที่แล้ว

      Hi utkasrsh, in this problem you basically just want to COUNT something (in this case managers). In order to count it, you have to make a couple of joins. Thats really all there is

  • @bhumikalalchandani321
    @bhumikalalchandani321 2 ปีที่แล้ว

    Bestt

  • @AnkitSharma-ds9mo
    @AnkitSharma-ds9mo 2 ปีที่แล้ว

    are we gonna get the same set of 58 questions while giving a shot for hackerank certification?

    • @thecodingmentor7701
      @thecodingmentor7701  2 ปีที่แล้ว

      No the hackerrank certifications have their own questions. You can also find videos about them in my channel!

  • @anuchauhan5048
    @anuchauhan5048 ปีที่แล้ว

    Weather observation station 5 missing 00:07:15…!

  • @ajtam05
    @ajtam05 2 ปีที่แล้ว

    I'm a bit confused on --> "If more than one student created the same number of challenges AND the count is less than the maximum number of challenges created, then exclude those students from the result."
    1. Shouldn't the WHERE clause be AND (versus OR)???
    2. Technically, shouldn't --> tnc.num_challenges >= MAX (versus = MAX)???
    WHERE
    tcc.count_challenges

    • @thecodingmentor7701
      @thecodingmentor7701  2 ปีที่แล้ว

      Hi Alex, thanks for your comment! Can you give me a timestamp for your question? 😉

  • @Sandra-b4c1r
    @Sandra-b4c1r 8 หลายเดือนก่อน

    Hi,
    In Weather Observation Station 8 I did something like that:
    SELECT
    DISTINCT City
    FROM Station
    WHERE LOWER(LEFT(City, 1)) IN ('a', 'e', 'i', 'o', 'u') AND LOWER(RIGHT(City, 1)) IN ('a', 'e', 'i', 'o', 'u') ;
    Maybe it would be helpfull for somebody

  • @trading_buddy
    @trading_buddy 2 ปีที่แล้ว

    2:24:31 🙄

  • @manaskumar8532
    @manaskumar8532 2 ปีที่แล้ว

    occuptions problem is not there in the video, please add that too

  • @adithya1577
    @adithya1577 ปีที่แล้ว +1

    where is weather station 5 problem?

  • @funmitoadeyemi4647
    @funmitoadeyemi4647 2 ปีที่แล้ว

    Has anyone taken the Andela hackerrank test and got similar questions?

  • @santiagobernaltinjaca5360
    @santiagobernaltinjaca5360 ปีที่แล้ว

    Soy de colombia, 1 dia

  • @Abhishek-tv8px
    @Abhishek-tv8px 2 ปีที่แล้ว

    is there only 58 questions for sql on hackerrak?

    • @thecodingmentor7701
      @thecodingmentor7701  2 ปีที่แล้ว

      Yes there are 58 SQL Challenges on Hackerrank. There are also other programming languages and certifications which include different querstions

  • @lakshgaming696
    @lakshgaming696 11 หลายเดือนก่อน

    Weather Observation Station 5 is missing

  • @koogymysta7029
    @koogymysta7029 ปีที่แล้ว

    you forgot Occupations (medium)

  • @IITian_Vlogs7
    @IITian_Vlogs7 10 หลายเดือนก่อน

    Voice is not clear. Else content is good.

    • @thecodingmentor7701
      @thecodingmentor7701  8 หลายเดือนก่อน

      Thanks! I got an extra microphone in some parts of the video. In the beginning I recorded with the computer mic which was not great. Glad you still liked it!

  • @abidhasan5583
    @abidhasan5583 2 ปีที่แล้ว

    bro that's gold dust.

  • @Anonymous____________A721
    @Anonymous____________A721 3 หลายเดือนก่อน

    Why the hell mistakes in every sum like beginner 😑😑😑😑
    Half time is wasted like that

  • @oldcmputer
    @oldcmputer ปีที่แล้ว

    Great info but remove your face from the learning exercises. It serves no value and obstructs / clutters the learning experience.

  • @fusionx4945
    @fusionx4945 2 ปีที่แล้ว

    thaxxxx broooooooo👩‍💻

  • @ashrafabdo5461
    @ashrafabdo5461 2 ปีที่แล้ว

    50:02
    select max(months * salary), count( *)
    from Employee
    where (months * salary) =
    (select max(months * salary) from Employee);

  • @ashrafabdo5461
    @ashrafabdo5461 2 ปีที่แล้ว

    1:11:47
    select
    round((max(lat_n)-min(long_w))+
    (max(long_w)-min(lat_n)),4)
    from station;