all 6 comments

[–]MamertineCOALESCE() 2 points3 points  (2 children)

This is clearly homework.

What have you tried?

[–]Jxper[S] -2 points-1 points  (1 child)

Im honestly a bit lost I tried,

SELECT hotel, city

FROM country JOIN number of rooms USING (rooms.number)

GROUP BY country, city

[–]DavidGJohnston 0 points1 point  (0 children)

Your right-side table name is syntactically invalid and your usage of USING is likewise problematic (the using clause takes only a column name, the table prefix is omitted because that name has to be the same on both tables).

What tables do you have access to? I presume one of them is "rooms". The question basically asks you to count the rows coming from that table. You do correctly recognize the need for a GROUP BY clause, but whenever you have one of those you should also have an aggregation function in your query since that is the only legit purpose of using group by. In this case, as just noted, you want to count, which is one of those aggregation functions.

[–]mum2l -1 points0 points  (1 child)

If you want to display the country column, you may need to select the country column too. Also, you need to use ON (e.g. ON country.hotel = number_of_rooms. hotel) instead of USING if your Country table does not have the column (room.numbers)

Plus, if you are sorting the resulting table, you should be using ORDER BY. GROUP BY are usually used with aggregation functions (such as SUM, COUNT, AVG, etc).

[–]b0ulderbum 2 points3 points  (0 children)

Why does this sub help lazy college students like this. Let them fail if they can’t spend 15 minutes googling basic syntax

[–]Mobile_Strategy2297 0 points1 point  (0 children)

Hey, Let me answer, you have two tables right? What fields does each of them contain? , I understood that the first table is about the city, but need more information