μ¬λ¬ μ΄λ¦λ€μ μ£Όκ³ , μ΄λ¦λ€μ ν¬ν¨νλ λ°μ΄ν° μ°ΎκΈ°
SELECT ANIMAL_ID,NAME,SEX_UPON_INTAKE FROM ANIMAL_INS
WHERE NAME = "Lucy" OR
NAME = "Ella" OR
NAME = "Pickle" OR
NAME = "Rogan" OR
NAME = "Sabrina" OR
NAME = "Mitty"
ORDER BY ANIMAL_ID
SELECT ANIMAL_ID,NAME,SEX_UPON_INTAKE FROM ANIMAL_INS
WHERE NAME in ("Lucy","Ella","Pickle","Rogan","Sabrina","Mitty")
ORDER BY ANIMAL_ID
http://www.tcpschool.com/mysql/mysql_operator_patternMatching
SELECT ANIMAL_ID,NAME FROM ANIMAL_INS
WHERE name LIKE "%EL%" AND animal_type = "Dog"
ORDER BY NAME
SELECT ANIMAL_ID,NAME,
CASE
WHEN SEX_UPON_INTAKE LIKE "%Neutered Male%" OR SEX_UPON_INTAKE LIKE "%Spayed Female"
THEN "O"
ELSE "X"
END
AS "μ€μ±ν"
FROM ANIMAL_INS
π κ°μ Date type λΌλ¦¬λ μ°μ°μ΄ κ°λ₯νλ€.
SELECT INS.ANIMAL_ID,INS.NAME FROM ANIMAL_INS INS
JOIN ANIMAL_OUTS OUTS
ON INS.ANIMAL_ID = OUTS.ANIMAL_ID
ORDER BY (OUTS.DATETIME - INS.DATETIME) DESC
LIMIT 2
SELECT ANIMAL_ID,NAME, DATE_FORMAT(DATETIME,'%Y-%m-%d') AS 'λ μ§'
FROM ANIMAL_INS
ORDER BY ANIMAL_ID