so in the code below, i'm doing a left outer join. But the thing I dont understand is : when the 2 tables are joined on dog_guid, apart from all of the rows from the reviews table which happens to be on the left, How can we process the condition WHERE d.dog_guid IS NULL as d.dog_guid has a NULL value and wont be a result of the join at all right ?
Please help me out :)
SELECT r.dog_guid AS rDogID, d.dog_guid AS dDogID, r.user_guid AS rUserID, d.user_guid AS dUserID, AVG(r.rating) AS AvgRating, COUNT(r.rating) AS NumRatings, d.breed, d.breed_group, d.breed_type
FROM reviews r LEFT JOIN dogs d
ON r.dog_guid=d.dog_guid AND r.user_guid=d.user_guid
WHERE d.dog_guid IS NULL
GROUP BY r.dog_guid
HAVING NumRatings >= 10
ORDER BY AvgRating DESC;
