I need to come up with a query that will show the percentage of a certain nationality in a given city
In a table, these are the given fields:
Id number of an individual
city code
nationality code
this is the sql code i have so far:
select distictrow popdata.citynum
count(*) from popdata
where popdata.ancnumber=720
group by popdata.citynum
order by count(*) desc;
-----ancnumber stands for the nationality code, 720 stands for one nationality,for this specific problem 720 means filipino
this sql gives me the number of filipinos in a given city, but i have problem coming up with the total population in a city in another column, and so cant solve the percentage
can anyone please help me? thank you very much!!
In a table, these are the given fields:
Id number of an individual
city code
nationality code
this is the sql code i have so far:
select distictrow popdata.citynum
count(*) from popdata
where popdata.ancnumber=720
group by popdata.citynum
order by count(*) desc;
-----ancnumber stands for the nationality code, 720 stands for one nationality,for this specific problem 720 means filipino
this sql gives me the number of filipinos in a given city, but i have problem coming up with the total population in a city in another column, and so cant solve the percentage
can anyone please help me? thank you very much!!