问题描述
我正在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”的表,
具有上面图像的结构,并获取列等级中值为10.0
的项目数。
我已经尝试过count(SELECT * FROM ratings WHERE rating=10.0
,但我相信计数无法像这样...
希望您能帮助我!谢谢!
解决方法
尝试以下-
select count(*)
FROM ratings WHERE rating=10.0
,
对于返回表的行数,我们使用SQL的count(*)函数。Select count(*) from ratings where rating where rating = 10.0 ;