Retired
SQL Basics: Simple HAVING (OLD) (retired)
212matt c
Loading description...
Fundamentals
SQL
Databases
Information Systems
Data
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
You should make this kata solvable or outright remove it, because it's suck in my unsolved katas, and it's pissing me off.
it's retired.
It can't be solved right now :'(
this kata is retired.
Yes, but it is still listed... the tests pass but you can't send the solution and it counts as a non solved kata... :(
I tried to use
GROUP BY people.id desc
but it gave an error, I don't understandt what is wrong about that. EDIT: OK it was supposed to be order by desc
What is the difference in SQL between HAVING COUNT and HAVING?
I beleive there is no issue here so resolving. also I don't exactly understand your question?
I agree with @cubittz that this is suboptimal and misleading example of using
HAVING
clause for someone who's learning SQL.do you have a suggestion
Sure.
With a data set close to yours an assignment can potentially read "Find all ages that more than one person has". Here is SQLFiddle This is a very typical use case. Another example: "Given a posts table with columns (id, title, author_id) find all author_id's that published more than two blog posts". SQLFiddle. You can sprinkle both examples with
ORDER BY
by requiring to sort the result set one way or another.Please let me know if I can help more.
good to see someones being mature with downvotes..
I've been trying to update a fix for awhile now and I did have one awhile ago but the recurring issues with republishing katas has stopped it from updating.
bear in mind this will be invalidating 160 solutions.
Maybe introduce an improved kata, put a disclaimer in this one and eventually discontinue it?
I don't believe it's possible to discontinue an already approved kata..
I've published a new one.
For people learnng SQL I think this Kata is a misleading example of HAVING. Sure, it gets the result, but grouping by id, which is a unique field?! 100% of developers would approach this problem using a where clause.
Also, the tests for the WHERE clause say they are testing for the presence of WHERE instead of the absence. Both Example and Submit Tests.
fixed.
This could have been done with a WHERE clause. When working with aggregated values, there are things which cannot be done with a WHERE clause and have to be done with a HAVING clause. Wouldn't it be more clear to do with a WHERE clause what can be done with a WHERE clause and do with a HAVING clause what has to be done with a HAVING clause?
(I have always lived under the presumption SQL actually required this anyway. Apparently, I was wrong, at least for this implementation of SQL.)
fixed.
The test with the message "should contain WHERE" misses the "no" or "not" in example and real tests!
fixed.