[Level4] JOIN(2)
우유와 요거트가 담긴 장바구니
SELECT CART_ID
FROM CART_PRODUCTS
WHERE NAME IN ('Milk', 'Yogurt')
GROUP BY CART_ID
HAVING COUNT(DISTINCT NAME) = 2
ORDER BY ID
보호소에서 중성화한 동물
SELECT O.ANIMAL_ID, O.ANIMAL_TYPE, O.NAME
FROM ANIMAL_OUTS O
JOIN ANIMAL_INS I
USING(ANIMAL_ID)
WHERE I.SEX_UPON_INTAKE LIKE 'Intact%'
AND O.SEX_UPON_OUTCOME NOT LIKE 'Intact%'
ORDER BY ANIMAL_ID