mikeizbicki / cmc-csci143

big data course materials
41 stars 76 forks source link

has anyone figured out 07b? #461

Closed giffiecode closed 8 months ago

giffiecode commented 9 months ago
SELECT DISTINCT film.title
FROM film
JOIN inventory ON film.film_id = inventory.film_id
LEFT JOIN rental ON inventory.inventory_id = rental.inventory_id
LEFT JOIN customer ON rental.customer_id = customer.customer_id
LEFT JOIN address ON customer.address_id = address.address_id
LEFT JOIN city ON address.city_id = city.city_id
LEFT JOIN country ON city.country_id = country.country_id
WHERE country.country IS NULL OR country.country NOT ILIKE '%United States%'
GROUP BY film.title
ORDER BY film.title;

the above is my query. I got a lot of extra film titles listed in the query, and all the titles that are supposed to be included in the query are all there.

below is my error return after running diff command

-(958 rows)
+(360 rows)
giffiecode commented 9 months ago

I vaguely understand why: my query is getting all films that have been rented by non-americans instead of getting the films that haven't been rented by americans, but I don't know how to fix it.

Has anyone figured this out?