์ฝ”๋”ฉํ…Œ์ŠคํŠธ 2

[ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค] SQL Lv.2 ๋ฌธ์ œํ’€์ด ์ •๋‹ต ๋ชจ์Œ (feat. ์ฝ”๋”ฉํ…Œ์ŠคํŠธ)

๋ฌธ์ œ ํ’€์ด ๊ธฐ๊ฐ„ : 24๋…„ 12์›” 20์ผ ~  ์ตœ์‹ ์ˆœ์œผ๋กœ ์ •๋ ฌํ•œ ๋ฌธ์ œ ์ˆœ์„œ์ž…๋‹ˆ๋‹ค ์ตœ์†Ÿ๊ฐ’ ๊ตฌํ•˜๊ธฐSELECT MIN(DATETIME) AS ์‹œ๊ฐ„FROM ANIMAL_INS ๊ณ ์–‘์ด์™€ ๊ฐœ๋Š” ๋ช‡ ๋งˆ๋ฆฌ ์žˆ์„๊นŒSELECT ANIMAL_TYPE , COUNT(*) AS countFROM ANIMAL_INSGROUP BY ANIMAL_TYPEORDER BY ANIMAL_TYPE ๋™๋ช… ๋™๋ฌผ ์ˆ˜ ์ฐพ๊ธฐSELECT NAME , COUNT (NAME) AS COUNTFROM ANIMAL_INSGROUP BY NAMEHAVING COUNT >= 2ORDER BY NAMECOUNT(NAME) = COUNT(*) ์ด์ง€๋งŒ, NAME์ด๋ผ๊ณ  ํŠน์ • ์ง€์œผ๋ฉด, null ๊ฐ’์„ ์ œ์™ธํ•˜๊ณ  count๋ฅผ ํ•œ๋‹ค  ๋ฃจ์‹œ์™€ ์—˜๋ผ ์ฐพ๊ธฐSE..

[ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค] SQL Lv.1 ๋ฌธ์ œํ’€์ด ์ •๋‹ต ๋ชจ์Œ (feat. ์ฝ”๋”ฉํ…Œ์ŠคํŠธ)

๋ฌธ์ œ ํ’€์ด ๊ธฐ๊ฐ„ : 24๋…„ 12์›” 17์ผ ~ 19์ผ  ์ตœ์‹ ์ˆœ์œผ๋กœ ์ •๋ ฌํ•œ ๋ฌธ์ œ ์ˆœ์„œ์ž…๋‹ˆ๋‹ค ๋ชจ๋“  ๋ ˆ์ฝ”๋“œ ์กฐํšŒํ•˜๊ธฐ SELECT *FROM ANIMAL_INSORDER BY ANIMAL_ID ASC; ์—ญ์ˆœ ์ •๋ ฌํ•˜๊ธฐSELECT NAME, DATETIMEFROM ANIMAL_INSORDER BY ANIMAL_ID DESC; ์•„ํ”ˆ ๋™๋ฌผ ์ฐพ๊ธฐSELECT ANIMAL_ID, NAMEFROM ANIMAL_INSWHERE INTAKE_CONDITION = 'Sick'ORDER BY ANIMAL_ID; ์–ด๋ฆฐ ๋™๋ฌผ ์ฐพ๊ธฐSELECT ANIMAL_ID, NAMEFROM ANIMAL_INSWHERE INTAKE_CONDITION != 'Aged'ORDER BY ANIMAL_ID; ์ด๋ฆ„์ด ์—†..