![](/img/trans.png)
[英]In SQL, how can I create a list of libraries with a count of books from a database containing a table of libraries and a table of books?
[英]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.
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.
所以基本上我要做的就是將 go 放入一個名為“評級”的表中,
它具有上圖的結構,並獲取列 rating 中有多少項的值為10.0
。
我試過count(SELECT * FROM ratings WHERE rating=10.0
但我相信 count 不是那樣工作的......
希望你能幫助我! 謝謝!
試試下面 -
select count(*)
FROM ratings WHERE rating=10.0
為了返回表的行數,我們使用 count(*) SQL 的 function。
Select count(*) from ratings where rating where rating = 10.0;
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.