SQL Trends in Startup Question 9

Hello all!

Hope you are well. I had a simple question.

for the first line of code, why do we also have to select category?

thanks in advance for the help.

Additionally, I am having a bit of trouble differentiating between the clause of WHERE and HAVING. May someone also explain this to me?

I believe the question wants to know the average value of each startup in each company category. Right?

Sometimes questions can be confusing (I totally get that!). But, if you break it down or draw out what the question is asking, maybe that would help(?) (The question pretty much highlights/states what columns to use in the SELECT statement)


WHERE filters rows and HAVING filters groups.

This is another explanation if what is in the lesson isn’t clear.


You have to select category because you want the categories to be displayed in the table that this query returns, alongside the rounded, averaged valuations. This way, you’ll be able to see the average valuations beside the categories with which they’re associated.

Which is what I said above… :upside_down_face:

Hey all!

I am having a little trouble with the FUNCTION abbreviation option following HAVING.

Is it the case that, unlike can be done with ORDER BY, HAVING does not take an abbreviated number of an aggregate function? Notice how when I add change the aggregate function wording to 2 following the HAVING, that the query is not called.

See the attached images to understand more.

HAVING filters groups. It doesn’t know what “2” refers to.
Also, it’s better to not use column numbers in SQL queries for a number of reasons.

1 Like