だから私はクエリを持っています:
select states, count(numberofcounty)
from countytable
group by states
order by count(distinct numberofcounty) ASC;
これは、州の数と郡の数の 2 列のテーブルを返します。単一の実数で州ごとにいくつの郡があるかの平均を取得するにはどうすればよいですか?
テーブル構造は次のとおりです。
create table numberofcounty(
numberofcounty text,
states text references states(states),
);
create table states (
states text primary key,
name text,
admitted_to_union text
);