cs50 / check50

This is check50, a command-line program with which you can check the correctness of your programs.
GNU General Public License v3.0
401 stars 268 forks source link

Possible bug in check50 for movies problem set in 4th exercise. #346

Closed AnderGI closed 3 months ago

AnderGI commented 3 months ago

Exercise description:

In 4.sql, write a SQL query to determine the number of movies with an IMDb rating of 10.0.

Query

SELECT COUNT(id) FROM movies WHERE id = ( SELECT movie_id FROM ratings WHERE rating = 10.0 );

Output in the check50

SELECT COUNT(id) FROM movies WHERE id = ( SELECT movie_id FROM ratings WHERE rating = 10.0 );

Result

Executing 4.sql results in a table with 1 column and 1 row.

Isn't there an inconsistency issue in that test case?

AnderGI commented 3 months ago

SELECT COUNT(id) FROM movies WHERE id IN ( SELECT DISTINCT movie_id FROM ratings WHERE rating = 10.0 ); IN for multiple rows DISTINCT for avoiding duplicates