Notice
Recent Posts
Recent Comments
Link
거의 알고리즘 일기장
프로그래머스 고득점 키트_ JOIN_MYSQL 본문
https://programmers.co.kr/learn/challenges?selected_part_id=17046
1. 없어진 기록찾기
1
2
3
4
5
|
select aout.ANIMAL_ID, aout.NAME
from ANIMAL_OUTS as aout
left join ANIMAL_INS as ain
on aout.ANIMAL_ID = ain.ANIMAL_ID
where ain.ANIMAL_ID is null
|
http://colorscripter.com/info#e" target="_blank" style="text-decoration:none;color:white">cs |
2. 있었는데요 없었습니다.
1
2
3
4
5
6
|
select ain.ANIMAL_ID, ain.NAME
from ANIMAL_INS as ain
join ANIMAL_OUTS as aout
on ain.ANIMAL_ID = aout.ANIMAL_ID
where ain.DATETIME > aout.DATETIME
order by ain.DATETIME
|
http://colorscripter.com/info#e" target="_blank" style="text-decoration:none;color:white">cs |
3. 오랜 기간 보호한 동물
1
2
3
4
5
6
7
|
from ANIMAL_INS as ain
left join ANIMAL_OUTS as aout
on ain.ANIMAL_ID = aout.ANIMAL_ID
order by ain.DATETIME
limit 3
http://colorscripter.com/info#e" target="_blank" style="color:#4f4f4ftext-decoration:none">Colored by Color Scripter
|
http://colorscripter.com/info#e" target="_blank" style="text-decoration:none;color:white">cs |
4. 보호소에서 중성화한 동물
1
2
3
4
5
6
7
8
9
|
select ain.ANIMAL_ID, ain.ANIMAL_TYPE, ain.NAME
from ANIMAL_INS as ain
inner join ANIMAL_OUTS as aout
on ain.ANIMAL_ID = aout.ANIMAL_ID
where ain.SEX_UPON_INTAKE like "Intact%"
and aout.SEX_UPON_OUTCOME like "Neutered%"
or ain.SEX_UPON_INTAKE like "Intact%"
and aout.SEX_UPON_OUTCOME like "Spayed%"
order by ain.ANIMAL_ID
|
http://colorscripter.com/info#e" target="_blank" style="text-decoration:none;color:white">cs |
반응형
'SQL 문제' 카테고리의 다른 글
프로그래머스 고득점 키트 _ String, Date_MYSQL (0) | 2020.04.24 |
---|---|
프로그래머스 고득점 키트 _ IS NULL_MYSQL (0) | 2020.04.24 |
프로그래머스 고득점 키트 _ GROUP BY_MYSQL (0) | 2020.04.23 |
프로그래머스 고득점 키트_ SUM, MAX, MIN_MYSQL (0) | 2020.04.23 |
프로그래머스 고득점 키트_ SELECT_MYSQL (0) | 2020.04.23 |
Comments