Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/flash/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql 是否可以使用某种分组查询,根据列中的数字分组?_Sql_Sqlite_Select_Count - Fatal编程技术网

Sql 是否可以使用某种分组查询,根据列中的数字分组?

Sql 是否可以使用某种分组查询,根据列中的数字分组?,sql,sqlite,select,count,Sql,Sqlite,Select,Count,我有一张非常简单的桌子: CREATE TABLE "Score"( "Id" varchar primary key not null , "EnglishCount" int , "RomajiCount" int ) 是否有一种我可以运行的查询类型可以显示: how many rows have EnglishCount = 0, how many rows have EnglishCount = 1, how many rows have EnglishCount =

我有一张非常简单的桌子:

CREATE TABLE "Score"(
"Id" varchar primary key not null ,
"EnglishCount" int ,
"RomajiCount" int )
是否有一种我可以运行的查询类型可以显示:

   how many rows have EnglishCount = 0,
   how many rows have EnglishCount = 1,
   how many rows have EnglishCount = 2,
   how many rows have EnglishCount = 3,
   how many rows have EnglishCount = 4,
   etc ...
以下是我希望得到的输出:

Count    Instances
0        1
1        2
3        1
4        5
5        2

您可以使用
group by
子句将
EnglishCount
的每个不同值的结果分开,然后对每个组应用
count(*)

SELECT   EnglishCount, COUNT(*)
FROM     Score
GROUP BY EnglishCount