The Report in SQL | HackerRank Programming Solutions | HackerRank SQL Solutions

The Report SQL | Hackerrank Solution

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 The Report 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 ProblemThe Report SQL – Hacker Rank Solution

The Report SQL – Hacker Rank Solution

Problem:

You are given two tables: Students and GradesStudents contains three columns IDName and Marks.

The Report

Grades contains the following data:

The Report

Ketty gives Eve a task to generate a report containing three columns: NameGrade and MarkKetty doesn’t want the NAMES of those students who received a grade lower than 8. The report must be in descending order by grade — i.e. higher grades are entered first. If there is more than one student with the same grade (8-10) assigned to them, order those particular students by their name alphabetically. Finally, if the grade is lower than 8, use “NULL” as their name and list them by their grades in descending order. If there is more than one student with the same grade (1-7) assigned to them, order those particular students by their marks in ascending order.

Write a query to help Eve.

Sample Input

The Report

Sample Output

Maria 10 99
Jane 9 81
Julia 9 88 
Scarlet 8 78
NULL 7 63
NULL 7 68


Note

Print “NULL”  as the name if the grade is less than 8.

Explanation

Consider the following table with the grades assigned to the students:

1443818026 0b3af8db30 4

So, the following students got 89 or 10 grades:

  • Maria (grade 10)
  • Jane (grade 9)
  • Julia (grade 9)
  • Scarlet (grade 8)
The Report SQL – Hacker Rank Solution
SELECT IF(g.Grade<8, NULL, s.Name), g.Grade, s.Marks FROM Students AS s 
JOIN Grades AS g ON s.Marks BETWEEN g.Min_Mark AND g.Max_Mark ORDER BY g.Grade DESC, s.Name, s.Marks;

153 thoughts on “The Report in SQL | HackerRank Programming Solutions | HackerRank SQL Solutions”

  1. Hey there this is somewhat of off topic but I was wondering if blogs use WYSIWYG editors or if you have to manually code with HTML. I’m starting a blog soon but have no coding experience so I wanted to get guidance from someone with experience. Any help would be enormously appreciated!

    Reply
  2. Having read this I thought it was very informative. I appreciate you taking the time and effort to put this article together. I once again find myself spending way to much time both reading and commenting. But so what, it was still worth it!

    Reply
  3. I used to be very pleased to find this web-site.I wanted to thanks on your time for this wonderful read!! I positively having fun with every little little bit of it and I’ve you bookmarked to take a look at new stuff you blog post.

    Reply
  4. I really like your blog.. very nice colors & theme. Did you make this website yourself or did you hire someone to do it for you? Plz reply as I’m looking to design my own blog and would like to find out where u got this from. cheers

    Reply
  5. Greetings! I know this is kinda off topic however I’d figured I’d ask. Would you be interested in trading links or maybe guest authoring a blog article or vice-versa? My site covers a lot of the same subjects as yours and I think we could greatly benefit from each other. If you happen to be interested feel free to shoot me an email. I look forward to hearing from you! Wonderful blog by the way!

    Reply
  6. Thank you so much for providing individuals with an extremely marvellous possiblity to check tips from this site. It really is very useful plus stuffed with amusement for me personally and my office acquaintances to visit your website at the very least 3 times in 7 days to see the fresh tips you have got. Not to mention, I’m just usually fascinated for the brilliant secrets you give. Some 3 ideas in this post are ultimately the finest we have all had.

    Reply
  7. Hello my friend! I wish to say that this article is awesome, nice written and include approximately all important infos. I?¦d like to see more posts like this .

    Reply
  8. I am extremely impressed with your writing skills as well as with the layout on your weblog. Is this a paid theme or did you customize it yourself? Anyway keep up the nice quality writing, it is rare to see a nice blog like this one today..

    Reply
  9. I will right away grab your rss feed as I can not find your email subscription link or newsletter service. Do you’ve any? Kindly let me know so that I could subscribe. Thanks.

    Reply
  10. F*ckin’ awesome things here. I am very glad to peer your post. Thanks a lot and i am taking a look forward to touch you. Will you please drop me a e-mail?

    Reply
  11. Those are yours alright! . We at least need to get these people stealing images to start blogging! They probably just did a image search and grabbed them. They look good though!

    Reply
  12. I’m not that much of a internet reader to be honest but your blogs really nice, keep it up! I’ll go ahead and bookmark your site to come back down the road. Cheers

    Reply
  13. Very well written article. It will be useful to everyone who usess it, including me. Keep doing what you are doing – for sure i will check out more posts.

    Reply
  14. Hiya, I’m really glad I’ve found this info. Today bloggers publish just about gossips and net and this is really annoying. A good blog with interesting content, this is what I need. Thank you for keeping this web-site, I’ll be visiting it. Do you do newsletters? Cant find it.

    Reply
  15. I have been browsing online more than 3 hours as of late, but I never discovered any fascinating article like yours. It¦s beautiful value sufficient for me. In my opinion, if all webmasters and bloggers made good content material as you did, the web might be a lot more helpful than ever before.

    Reply
  16. Oh my goodness! a tremendous article dude. Thank you Nevertheless I’m experiencing challenge with ur rss . Don’t know why Unable to subscribe to it. Is there anybody getting an identical rss problem? Anybody who knows kindly respond. Thnkx

    Reply
  17. Do you mind if I quote a couple of your posts as long as I provide credit and sources back to your weblog?

    My blog site is in the very same area of interest as yours and my visitors would
    certainly benefit from a lot of the information you present here.
    Please let me know if this ok with you. Many thanks!

    Reply

Leave a Comment

Ads Blocker Image Powered by Code Help Pro

Ads Blocker Detected!!!

We have detected that you are using extensions to block ads. Please support us by disabling these ads blocker🙏.

Powered By
Best Wordpress Adblock Detecting Plugin | CHP Adblock