15 Days of Learning in SQL | HackerRank Programming Solutions | HackerRank SQL Solutions

Hello Programmers/Coders, Today we are going to share solutions of Programming problems of HackerRank of Programming Language SQL. At Each Problem with Successful submission with all Test Cases Passed, you will get an score or marks. And after solving maximum problems, you will be getting stars. This will highlight your profile to the recruiters.

In this post, you will find the solution for 15 Days of Learning in SQL-HackerRank Problem. We are providing the correct and tested solutions of coding problems present on HackerRank. If you are not able to solve any problem, then you can take help from our Blog/website.

Use “Ctrl+F” To Find Any Questions Answer. & For Mobile User, You Just Need To Click On Three dots In Your Browser & You Will Get A “Find” Option There. Use These Option to Get Any Random Questions Answer.

Introduction To SQL

SQL stands for Structured Query Language. SQL is used to create, remove, alter the database and database objects in a database management system and to store, retrieve, update the data in a database. SQL is a standard language for creating, accessing, manipulating database management system. SQL works for all modern relational database management systems, like SQL Server, Oracle, MySQL, etc.

  • It is a standard language for Relational Database System. It enables a user to create, read, update and delete relational databases and tables.
  • All the RDBMS like MySQL, Informix, Oracle, MS Access and SQL Server use SQL as their standard database language.
  • SQL allows users to query the database in a number of ways, using English-like statements.

Link for the Problem15 Days of Learning SQL – Hacker Rank Solution

15 Days of Learning SQL – Hacker Rank Solution

Problem:

Julia conducted a  days of learning SQL contest. The start date of the contest was March 01, 2016 and the end date was March 15, 2016.

Write a query to print total number of unique hackers who made at least  submission each day (starting on the first day of the contest), and find the hacker_id and name of the hacker who made maximum number of submissions each day. If more than one such hacker has a maximum number of submissions, print the lowest hacker_id. The query should print this information for each day of the contest, sorted by the date.


Input Format

The following tables hold contest data:

  • Hackers: The hacker_id is the id of the hacker, and name is the name of the hacker.1458511164 12adec3b8b ScreenShot2016 03 21at3.26.47AM
  • Submissions: The submission_date is the date of the submission, submission_id is the id of the submission, hacker_id is the id of the hacker who made the submission, and score is the score of the submission. 1458511251 0b534030b9 ScreenShot2016 03 21at3.26.56AM

Sample Input

For the following sample input, assume that the end date of the contest was March 06, 2016.

Hackers Table: 1458511957 814a2c7bf2 ScreenShot2016 03 21at3.27.06AM Submissions Table: 1458512015 ff6a708164 ScreenShot2016 03 21at3.27.21AM

Sample Output

2016-03-01 4 20703 Angela
2016-03-02 2 79722 Michael
2016-03-03 2 20703 Angela
2016-03-04 2 20703 Angela
2016-03-05 1 36396 Frank
2016-03-06 1 20703 Angela
15 Days of Learning SQL – Hacker Rank Solution
SELECT t1.submission_date, hkr_cnt, t2.hacker_id, name
FROM (SELECT p1.submission_date, 
             COUNT(DISTINCT p1.hacker_id) AS hkr_cnt
      FROM (SELECT submission_date, hacker_id, 
                   @h_rnk := CASE WHEN @h_grp != hacker_id THEN 1 ELSE @h_rnk+1 END AS hacker_rank,
                   @h_grp := hacker_id AS hacker_group
            FROM (SELECT DISTINCT submission_date, hacker_id 
                  FROM submissions
                  ORDER BY hacker_id, submission_date) AS a, 
                 (SELECT @h_rnk := 1, @h_grp := 0) AS r) AS p1
      JOIN (SELECT submission_date, 
                   @d_rnk := @d_rnk + 1 AS date_rank
            FROM (SELECT DISTINCT submission_date
                  FROM submissions 
                  ORDER BY submission_date) AS b, 
                 (SELECT @d_rnk := 0) r) AS p2
      ON p1.submission_date = p2.submission_date 
         AND hacker_rank = date_rank
      GROUP BY p1.submission_Date) AS t1
JOIN (SELECT submission_date, hacker_id, sub_cnt,
             @s_rnk := CASE WHEN @d_grp != submission_date THEN 1 ELSE @s_rnk+1 END AS max_rnk,
             @d_grp := submission_date AS date_group
      FROM (SELECT submission_date, hacker_id, COUNT(*) AS sub_cnt
            FROM submissions AS s
            GROUP BY submission_date, hacker_id
            ORDER BY submission_date, sub_cnt DESC, hacker_id) AS c,
           (SELECT @s_rnk := 1, @d_grp := 0) AS r) AS t2                            
ON t1.submission_date = t2.submission_date AND max_rnk = 1
JOIN hackers AS h ON h.hacker_id = t2.hacker_id            
ORDER BY t1.submission_date
;

578 thoughts on “15 Days of Learning in SQL | HackerRank Programming Solutions | HackerRank SQL Solutions”

  1. excellent post, very informative. I wonder why the other experts of this sector don’t notice this. You should continue your writing. I’m sure, you’ve a huge readers’ base already!

    Reply
  2. I as well as my pals have been examining the nice points from your website while quickly developed a horrible suspicion I never expressed respect to the web site owner for those tips. My guys happened to be as a consequence passionate to read through all of them and already have seriously been making the most of these things. I appreciate you for turning out to be so helpful as well as for considering these kinds of wonderful information millions of individuals are really wanting to learn about. Our sincere regret for not expressing gratitude to you sooner.

    Reply
  3. The following time I read a blog, I hope that it doesnt disappoint me as a lot as this one. I mean, I do know it was my option to read, but I really thought youd have something fascinating to say. All I hear is a bunch of whining about one thing that you may repair if you happen to werent too busy on the lookout for attention.

    Reply
  4. That is very fascinating, You’re an overly skilled blogger. I’ve joined your feed and look forward to in quest of extra of your magnificent post. Additionally, I’ve shared your website in my social networks!

    Reply
  5. Greetings from Los angeles! I’m bored to death at work so I decided to check out your site on my iphone during lunch break. I really like the knowledge you present here and can’t wait to take a look when I get home. I’m surprised at how fast your blog loaded on my cell phone .. I’m not even using WIFI, just 3G .. Anyways, superb blog!

    Reply
  6. Russian Poker is played with 13 cards and only four players. Object of the game is to make your best poker hand with three different hands to complete. Pokerrr 2 is an online app that allows one to play with your friends by simply logging in and creating a room. The referral code for the room can be shared with your friends, and they will be ready to initiate a game with you. The app allows one to win prizes, but again it cannot be redeemed, or the experience cannot be applied to playing real poker. Although it’s one of the leading apps, it contains ads. Master the odds of real Texas Holdem by playing this free poker Texas Holdem game. Watch your skills improve as your high score shoots up with each free poker game. Each AI opponent has his own unique personality–just like real people–so you can figure out all the little quirks involved in playing real texas holdem poker
    http://bluehillpoolvilla.com/bbs/board.php?bo_table=free&wr_id=61166
    Castlevania is Konami’s spot for heroic adventures. Great gamers are crowned for taking on and subduing the vampires in the high adrenaline game. Castlevania gives players an opportunity to win great prizes as there are several bonus features. The pokie has 5 reels and can be played on 20, 30 or 40 bet lines. The Castlevania acts as the scatter symbols of the game. When you hunt down one of the four vampires in the game, you get to win one of the game’s four progressive jackpots. Select multiple genres to find your perfect match: Konami is recognized as the fourth biggest video-game manufacturer in Japan. Following the poor performance of the arcade sector, Konami diversified and entered into the manufacture of slot machines. Since 1978, the company began to establish strong ties with several game developers in the US so that they could get a clear idea about what players were looking for. Konami had the finances as well as the expertise required to turn the venture into a success.

    Reply
  7. I like the helpful info you provide in your articles. I will bookmark your blog and check once more right here frequently. I’m somewhat sure I’ll learn lots of new stuff proper right here! Best of luck for the next!

    Reply
  8. Thank you, I have recently been looking for information about this subject for ages and yours is the greatest I’ve discovered so far. But, what about the bottom line? Are you sure about the source?

    Reply
  9. One of the draws for traders here is the ability to trade in Bitcoin. Cash App says that it “may” charge a fee when you buy and sell, and by that it means Cash App “will” charge a fee. But just how much? The app charges a basic service fee for each transaction and potentially another fee based on the deposit speed you request: standard, rush or priority. Importantly, the standard speed will not cost extra, while the cost of rush and priority speeds depends on the congestion of the blockchain network when you place the order. Summary: The Cash App currently only offers users the ability to buy and sell Bitcoin (BTC) through their mobile banking platform. The company has announced no plans to support other crypto assets in the future, which makes it an extremely limited platform to get investment exposure to cryptocurrencies.
    http://www.sweetp.co.kr/bbs/board.php?bo_table=free&wr_id=1620
    Blockchain-based Gala Games is an ecosystem of games with simple mechanics, powered by over 16,000 player-run nodes. The players get to truly own whatever they earn during the game, be it an item or a status. Gala Games boast more than 1.3 million active monthly users. Crypto gaming is gaming where users spend or earn cryptocurrencies instead of fiat money. It allows developers to add another layer of reality to their games and ensure gamers’ security and anonymity since blockchain technology doesn’t require any personal details. NFT games use a combination of traditional gaming design and non-traditional gaming mechanisms, which are typically centered on NFTs. These games incorporate NFTs not just in the game mechanisms but also in their rules and player interactions. For example, the items you find in-game may be NFTs that you can collect, and you may be able to swap NFTs with other players. 

    Reply
  10. Good day! This is kind of off topic but I need some guidance from an established blog. Is it difficult to set up your own blog? I’m not very techincal but I can figure things out pretty quick. I’m thinking about creating my own but I’m not sure where to begin. Do you have any tips or suggestions? Thank you

    Reply
  11. Hiya! Quick question that’s completely off topic.

    Do you know how to make your site mobile friendly?
    My site looks weird when viewing from my iphone4.
    I’m trying to find a template or plugin that might be able
    to fix this issue. If you have any suggestions, please
    share. Thank you!

    Reply
  12. I think that everything posted was actually very reasonable.
    But, what about this? suppose you wrote a catchier title?

    I am not saying your content isn’t good., but suppose you added something that grabbed people’s attention? I mean 15 Days
    of Learning in SQL | HackerRank Programming Solutions | HackerRank
    SQL Solutions – Techno-RJ is a little boring. You should glance at Yahoo’s front page and watch how they
    create news titles to get people to click. You might try adding a
    video or a related pic or two to get readers excited about
    everything’ve written. Just my opinion, it might make your website a little livelier.

    Reply
  13. Hey there, I think your website might be having browser compatibility issues. When I look at your blog in Opera, it looks fine but when opening in Internet Explorer, it has some overlapping. I just wanted to give you a quick heads up! Other then that, very good blog!

    Reply
  14. Sight Care is a daily supplement proven in clinical trials and conclusive science to improve vision by nourishing the body from within. The Sight Care formula claims to reverse issues in eyesight, and every ingredient is completely natural.

    Reply
  15. Cortexi is a completely natural product that promotes healthy hearing, improves memory, and sharpens mental clarity. Cortexi hearing support formula is a combination of high-quality natural components that work together to offer you with a variety of health advantages, particularly for persons in their middle and late years. Cortex not only improves hearing but also decreases inflammation, eliminates brain fog, and gives natural memory protection.

    Reply
  16. Puravive introduced an innovative approach to weight loss and management that set it apart from other supplements. It enhances the production and storage of brown fat in the body, a stark contrast to the unhealthy white fat that contributes to obesity.

    Reply
  17. Nervogen Pro, A Cutting-Edge Supplement Dedicated To Enhancing Nerve Health And Providing Natural Relief From Discomfort. Our Mission Is To Empower You To Lead A Life Free From The Limitations Of Nerve-Related Challenges. With A Focus On Premium Ingredients And Scientific Expertise.

    Reply
  18. Dentitox Pro is a liquid dietary solution created as a serum to support healthy gums and teeth. Dentitox Pro formula is made in the best natural way with unique, powerful botanical ingredients that can support healthy teeth.

    Reply
  19. SonoVive™ is an all-natural supplement made to address the root cause of tinnitus and other inflammatory effects on the brain and promises to reduce tinnitus, improve hearing, and provide peace of mind.

    Reply
  20. Gorilla Flow is a non-toxic supplement that was developed by experts to boost prostate health for men. It’s a blend of all-natural nutrients, including Pumpkin Seed Extract Stinging Nettle Extract, Gorilla Cherry and Saw Palmetto, Boron, and Lycopene.

    Reply
  21. TerraCalm is an antifungal mineral clay that may support the health of your toenails. It is for those who struggle with brittle, weak, and discoloured nails. It has a unique blend of natural ingredients that may work to nourish and strengthen your toenails.

    Reply
  22. Kerassentials are natural skin care products with ingredients such as vitamins and plants that help support good health and prevent the appearance of aging skin. They’re also 100% natural and safe to use. The manufacturer states that the product has no negative side effects and is safe to take on a daily basis. Kerassentials is a convenient, easy-to-use formula.

    Reply
  23. Cortexi is an effective hearing health support formula that has gained positive user feedback for its ability to improve hearing ability and memory. This supplement contains natural ingredients and has undergone evaluation to ensure its efficacy and safety. Manufactured in an FDA-registered and GMP-certified facility, Cortexi promotes healthy hearing, enhances mental acuity, and sharpens memory.

    Reply
  24. Brilliant work! The article is both informative and interesting. Have you considered including more images in your next articles? It might enhance the overall reader experience.

    Reply
  25. EndoPump is a dietary supplement for men’s health. This supplement is said to improve the strength and stamina required by your body to perform various physical tasks. Because the supplement addresses issues associated with aging, it also provides support for a variety of other age-related issues that may affect the body. https://endopumpbuynow.us/

    Reply
  26. Illuderma is a serum designed to deeply nourish, clear, and hydrate the skin. The goal of this solution began with dark spots, which were previously thought to be a natural symptom of ageing. The creators of Illuderma were certain that blue modern radiation is the source of dark spots after conducting extensive research. https://illudermabuynow.us/

    Reply
  27. Red Boost is a male-specific natural dietary supplement. Nitric oxide is naturally increased by it, which enhances blood circulation all throughout the body. This may improve your general well-being. Red Boost is an excellent option if you’re trying to assist your circulatory system. https://redboostbuynow.us/

    Reply
  28. EndoPump is a dietary supplement for men’s health. This supplement is said to improve the strength and stamina required by your body to perform various physical tasks. Because the supplement addresses issues associated with aging, it also provides support for a variety of other age-related issues that may affect the body. https://endopumpbuynow.us/

    Reply
  29. Cortexi is a completely natural product that promotes healthy hearing, improves memory, and sharpens mental clarity. Cortexi hearing support formula is a combination of high-quality natural components that work together to offer you with a variety of health advantages, particularly for persons in their middle and late years. https://cortexibuynow.us/

    Reply
  30. Glucofort Blood Sugar Support is an all-natural dietary formula that works to support healthy blood sugar levels. It also supports glucose metabolism. According to the manufacturer, this supplement can help users keep their blood sugar levels healthy and within a normal range with herbs, vitamins, plant extracts, and other natural ingredients. https://glucofortbuynow.us/

    Reply
  31. Unlock the incredible potential of Puravive! Supercharge your metabolism and incinerate calories like never before with our unique fusion of 8 exotic components. Bid farewell to those stubborn pounds and welcome a reinvigorated metabolism and boundless vitality. Grab your bottle today and seize this golden opportunity! https://puravivebuynow.us/

    Reply
  32. Island Post is the website for a chain of six weekly newspapers that serve the North Shore of Nassau County, Long Island published by Alb Media. The newspapers are comprised of the Great Neck News, Manhasset Times, Roslyn Times, Port Washington Times, New Hyde Park Herald Courier and the Williston Times. Their coverage includes village governments, the towns of Hempstead and North Hempstead, schools, business, entertainment and lifestyle. https://islandpost.us/

    Reply
  33. Sumatra Slim Belly Tonic is a unique weight loss supplement that sets itself apart from others in the market. Unlike other supplements that rely on caffeine and stimulants to boost energy levels, Sumatra Slim Belly Tonic takes a different approach. It utilizes a blend of eight natural ingredients to address the root causes of weight gain. By targeting inflammation and improving sleep quality, Sumatra Slim Belly Tonic provides a holistic solution to weight loss. These natural ingredients not only support healthy inflammation but also promote better sleep, which are crucial factors in achieving weight loss goals. By addressing these underlying issues, Sumatra Slim Belly Tonic helps individuals achieve sustainable weight loss results.

    Reply
  34. 🚀 Wow, this blog is like a rocket launching into the universe of excitement! 🎢 The mind-blowing content here is a rollercoaster ride for the mind, sparking excitement at every turn. 🎢 Whether it’s lifestyle, this blog is a source of inspiring insights! 🌟 Embark into this thrilling experience of knowledge and let your imagination roam! 🌈 Don’t just explore, immerse yourself in the excitement! #FuelForThought Your brain will be grateful for this exciting journey through the worlds of awe! ✨

    Reply
  35. 💫 Wow, this blog is like a cosmic journey launching into the galaxy of excitement! 🎢 The captivating content here is a rollercoaster ride for the imagination, sparking awe at every turn. 💫 Whether it’s inspiration, this blog is a source of exciting insights! #AdventureAwaits 🚀 into this cosmic journey of imagination and let your thoughts fly! 🚀 Don’t just explore, experience the excitement! #BeyondTheOrdinary Your brain will thank you for this thrilling joyride through the dimensions of endless wonder! 🚀

    Reply
  36. 💫 Wow, this blog is like a rocket soaring into the universe of endless possibilities! 🎢 The thrilling content here is a thrilling for the imagination, sparking awe at every turn. 🎢 Whether it’s lifestyle, this blog is a source of exciting insights! #InfinitePossibilities Dive into this thrilling experience of discovery and let your mind fly! ✨ Don’t just enjoy, immerse yourself in the excitement! #BeyondTheOrdinary 🚀 will thank you for this exciting journey through the realms of endless wonder! 🌍

    Reply
  37. I am absolutely thrilled to introduce you to the incredible Sumatra Slim Belly Tonic! This powdered weight loss formula is like no other, featuring a powerful blend of eight natural ingredients that are scientifically linked to fat burning, weight management, and overall weight loss. Just imagine the possibilities! With Sumatra Slim Belly Tonic, you have the opportunity to finally achieve your weight loss goals and transform your body into the best version of yourself.

    Reply
  38. Prostadine contains some of the most powerful anti-inflammatory herbal extracts known to clear out this inflammation. These herbs also protect your prostate from future toxic accumulation to prevent inflammation from causing painful urination, ejaculation issues, and frequent urination.

    Reply
  39. Howdy! This is my first visit to your blog! We are a group of volunteers and starting a new initiative in a community in the same niche. Your blog provided us useful information to work on. You have done a extraordinary job!

    Reply
  40. I was wondering if you ever considered changing the layout of your blog? Its very well written; I love what youve got to say. But maybe you could a little more in the way of content so people could connect with it better. Youve got an awful lot of text for only having one or two images. Maybe you could space it out better?

    Reply
  41. After looking at a few of the blog posts on your site, I honestly appreciate your way of blogging. I added it to my bookmark site list and will be checking back in the near future. Please visit my web site as well and let me know what you think.

    Reply
  42. When I originally left a comment I seem to have clicked on the -Notify me when new comments are added- checkbox and from now on whenever a comment is added I recieve four emails with the exact same comment. Perhaps there is a means you can remove me from that service? Thanks a lot!

    Reply
  43. Hello there! This article could not be written much better! Reading through this article reminds me of my previous roommate! He always kept talking about this. I’ll send this post to him. Fairly certain he’ll have a great read. Many thanks for sharing!

    Reply
  44. Thanks for the marvelous posting! I actually enjoyed reading it, you’re a great author. I will be sure to bookmark your blog and will often come back sometime soon. I want to encourage that you continue your great writing, have a nice afternoon!

    Reply
  45. That is really interesting, You’re an overly skilled blogger. I have joined your feed and look ahead to in the hunt for extra of your wonderful post. Also, I’ve shared your web site in my social networks!

    Reply
  46. There are definitely a lot of particulars like that to take into consideration. That is a great point to carry up. I offer the thoughts above as general inspiration however clearly there are questions like the one you convey up the place crucial thing shall be working in honest good faith. I don?t know if finest practices have emerged around issues like that, but I’m certain that your job is clearly recognized as a good game. Each boys and girls feel the affect of just a moment’s pleasure, for the remainder of their lives.

    Reply
  47. I was wondering if you ever thought of changing the page layout of your website? Its very well written; I love what youve got to say. But maybe you could a little more in the way of content so people could connect with it better. Youve got an awful lot of text for only having 1 or two pictures. Maybe you could space it out better?

    Reply
  48. I’m thoroughly impressed by how your post captures the essence of this wonderful Monday. It’s a joy to read your thoughts. Perhaps adding more images could make your future posts even more engaging.

    Reply
  49. Hmm is anyone else experiencing problems with the pictures on this blog loading? I’m trying to find out if its a problem on my end or if it’s the blog. Any responses would be greatly appreciated.

    Reply