如何输出一个 table,其中包含 SQL 中符合此条件的所有项目的计数?

How can I output a table containing the count of all items that match this condition in SQL?

我正在处理 CS50 pset7 SQLite 查询,但遇到了这个问题: write a SQL query to determine the number of movies with an IMDb rating of 10.0. Your query should output a table with a single column and a single row (plus optional header) containing the number of movies with a 10.0 rating. 所以基本上我要做的就是进入一个名为 'ratings'、

的 table

有上图的结构,得到rating栏中有多少条的值为10.0

我试过 count(SELECT * FROM ratings WHERE rating=10.0 但我认为计数不是那样的...

希望你能帮助我!谢谢!

试试下面的 -

   select count(*)
     FROM ratings WHERE rating=10.0

为了返回 table 的行数,我们使用 SQL.
的 count(*) 函数 Select count(*) from ratings where rating where rating = 10.0 ;