목록mysql (45)
happy coding
동물 보호소에 들어온 동물 이름 중 두 번 이상 쓰인 이름과 해당 이름이 쓰인 횟수를 조회하는 SQL문을 작성해주세요. 이때 결과는 이름이 없는 동물은 집계에서 제외하며, 결과는 이름 순으로 조회해주세요. SELECT NAME, COUNT(NAME) AS 'COUNT' FROM ANIMAL_INS GROUP BY NAME HAVING COUNT(NAME) > 1 ORDER BY NAME;
SELECT WAREHOUSE_ID, WAREHOUSE_NAME, ADDRESS, FREEZER_YN, CASE WHEN FREEZER_YN IS NULL THEN 'N' ELSE FREEZER_YN END AS FREEZER_YN FROM FOOD_WAREHOUSE ORDER BY WAREHOUSE_ID ASC; 이렇게 했는데 안바꼈다. SELECT WAREHOUSE_ID, WAREHOUSE_NAME, ADDRESS, CASE WHEN UPPER(FREEZER_YN) IS NULL THEN 'N' ELSE UPPER(FREEZER_YN) END AS FREEZER_YN FROM FOOD_WAREHOUSE ORDER BY WAREHOUSE_ID ASC; 맞게 나온 것 같은데 틀렸다. 봤더니 경기도 필터링..
SELECT ANIMAL_ID FROM ANIMAL_INS WHERE NAME IS NULL ORDER BY ANIMAL_ID ASC;
SELECT FACTORY_ID, FACTORY_NAME, ADDRESS FROM FOOD_FACTORY WHERE ADDRESS LIKE '%강원도%' ORDER BY FACTORY_ID ASC;
SELECT ANIMAL_ID, ANIMAL_TYPE, DATETIME, INTAKE_CONDITION, NAME, SEX_UPON_INTAKE FROM ANIMAL_INS;
SELECT DR_NAME, DR_ID, MCDP_CD, DATE_FORMAT(HIRE_YMD, '%Y-%m-%d') FROM DOCTOR WHERE MCDP_CD = 'CS' OR MCDP_CD = 'GS' ORDER BY HIRE_YMD DESC, DR_NAME ASC;
SELECT PT_NAME, PT_NO, GEND_CD, AGE, CASE WHEN TLNO IS NULL THEN 'NONE' ELSE TLNO END AS TLNO FROM PATIENT WHERE AGE < 13 AND GEND_CD = 'W' ORDER BY AGE DESC, PT_NAME ASC;