I'm struggling to understand what you mean after the code you wrote as the query produced needs to have country_id, region_id and all the locations each id under country_id and region_id has . As shown in the two tables country_id is the foreign key in the locatiosn tables and some of the id's under this columb repeat. i need to know how many countries each id has. Then show how many locations each region_id has. so the query table should have country_id then another column next to it called total locations for each country_id then next to this region_id then next to this a total locations columbn for each region_id.

Ah i see now i will provide the sql file im using so you can understand what I'm trying to say. Basically all i have and understand is that i have to complete this question and have to test the query on the code im going to upload.

How do i use both of these tables to answer this question, what method do i use can i have a code example please

Any help is really appreciated, new to sql and learning pls dont be too harsh

many times.

It is not clear what you mean by what you have written in the title repeating what? How many what?

In the select I have given the count(*) gives the number of locations per country_id in oehr_countries. For ordering as you indicating you only have to add order by country_id desc. If that is nto what you need, then what would you like to have?

Sorry ignore the title i was really confused, i think i might be confused with what i need for the question. I have now uploaded the sample data. From that sample data i need to run a query based on this question using the sample data.