如何在SQL中输出包含符合此条件的所有项目计数的表?


春风助手
2024-12-13 06:26:09 (2月前)

我正在使用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”的表,表结构https://i.stack.imgur.com/CFHoX.png

其中具有上图的结构,并获得列等级中值为的项目数10.0。

我已经尝试过,count(SELECT * FROM ratings WHERE rating=10.0但我相信count不能那样工作…

希望你能帮助我!谢谢!

2 条回复
  1. 1# 只怕再见是故人 | 2020-08-18 17-28

    请尝试以下-

    1. select count(*)
    2. FROM ratings WHERE rating=10.0
登录 后才能参与评论