Post removed in response to a DMCA take down notice by Codility.
(post withdrawn by author, will be automatically deleted in 24 hours unless flagged)
Nice... sounds like someone will get an "A" on their homework without even trying.
The OP did make the effort to post their homework on this site.lol
They wouldn't get an "A" from me. There's no way someone just learning SQL would ever write the query I wrote.
Well.No one can just assume that this question was posted without making my own efforts to solve it. I hope there are many more interesting questions to comment than wasting your time on this
Nor can anyone just assume that this question was posted after the OP made efforts to solve it.
On another SQL Server forum I was active on, there was a very clear policy to not answer this kind of questions. The OP first had to come up with what (s)he had done, before anyone on the forum would jump in to solve the question.
As soon as some proof was delivered they were as helpful as the people on this forum.
But before that, they stated very clear their forum was not intended to solve people's homework.
You have to understand the nature of the beast a bit. Your post looks like something right out of a homework or interview problem. There's nothing in the post to suggest otherwise and there are a ton of people that DO post homework and interview questions.
So, without some indication that you've tried something, what we're actually trying to do is NOT waste of bunch of time helping someone that has no intention of helping themselves. If you don't fall into that category, then apologies to you but do try to understand why the subject came up.
I understand there was nothing in the question to illustrate that I've tried something. I came to know about this correct way of asking a question only after I posted this question since I'm new to this community. It could have been great if you had just corrected a new user in this forum by replying back to the user to ask if what the user has tried in a polite manner, instead of blindly judging the user and mocking at the user that the user is trying to get an "A" in his homework without trying.
It is true that I blindly judged you and I've apologized for that. I've also explained why the blind judgement occurred. We've both learned a bit about this.
For the record, I've been advised that there was DCMA complaint about the original question on this thread being copied directly from an assessment test. Of course, the question has been taken down but perhaps I wasn't so blind after all.
Dear @JeffModen you don't have to prove anything to us. You are a highly valued jedi master SQL guru. I know I have learned a lot from you & you apologized, that in itself is worth more than gold these days. technology may come and go, people will always be here.
Thank you, ol' friend. You've made my day.