• 없어진 기록 찾기

    select b.animal_id, b.name
    
    from animal_ins a right join animal_outs b on a.animal_id = b.animal_id
    
    where a.animal_id is null
    
    order by b.animal_id
  • 오랜 기간 보호한 동물(1)

    SELECT a.NAME, a.DATETIME
    
    FROM ANIMAL_INS a left join ANIMAL_OUTS b on a.ANIMAL_ID = b.ANIMAL_ID
    
    WHERE b.ANIMAL_ID is NULL
    
    ORDER BY a.DATETIME
    LIMIT 3
  • 보호소에서 중성화한 동물

    SELECT a.ANIMAL_ID, a.ANIMAL_TYPE, a.NAME
    
    FROM ANIMAL_INS a join ANIMAL_OUTS b on
    a.ANIMAL_ID = b.ANIMAL_ID
    
    WHERE a.SEX_UPON_INTAKE LIKE "%Intact%" and b.SEX_UPON_OUTCOME NOT LIKE "%Intact%"
    
    ORDER BY a.ANIMAL_ID
    • like문 글자수 매칭은 _