mikeizbicki / cmc-csci143

big data course materials
40 stars 76 forks source link

Bug in pagila-hw3 expected/12.out #467

Closed mikeizbicki closed 8 months ago

mikeizbicki commented 8 months ago

Overview:

@henrylong612 found a bug in the expected/12.out file of the pagila-hw3 repo. I have uploaded a fixed version of the file to the repo. If you have not already solved this problem, then I recommend that you run git pull origin master in order to get the corrected file. If you have already solved this problem and have a passing test case, there is no need to update your solution to the new expected output.


Details of my mistake:

The prompt for homework 12 reads:

A new James Bond movie will be released soon, and management wants to send promotional material to "action fanatics". They've decided that an action fanatic is any customer where at least 4 of their 5 most recently rented movies are action movies.

Write a SQL query that finds all action fanatics.

My original query that was the basis for the expected/12.out file used an incorrect formula to determine who was an "action fanatic". Instead of computing whether 4 of their 5 most recently rented movies were action movies, I computed whether they had ever rented 4 action movies period (accidentally ignoring if those 4 movies were in the 5 most recently rented movies). This caused the results to include many more customers than it should have. In the original expected output, 330 customers were considered action fanatics, but the correct number is only two.

The full diff of the changes can be found at: https://github.com/mikeizbicki/pagila-hw3/commit/d332e27befcf8813715d310387302ce5ff445616