Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

D11 #31

Merged
merged 2 commits into from
Mar 3, 2023
Merged

D11 #31

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions K_ule/2023.02.28-L2
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
1번 : 최솟값 구하기
SELECT MIN(DATETIME)
FROM ANIMAL_INS

2번 : 고양이와 개는 몇 마리 있을까
select distinct ANIMAL_TYPE,
count(ANIMAL_TYPE) over(partition by ANIMAL_TYPE)as count
from ANIMAL_INS
where ANIMAL_TYPE in ('cat','dog')

-- count(distinct ANIMAL_TYPE) 도 가능

3번 : 동명 동물 수 찾기
select NAME ,count(NAME) as COUNT
from ANIMAL_INS
group by NAME
having count(NAME)>1
order by NAME
15 changes: 15 additions & 0 deletions K_ule/2023.02.28-L2-2
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
1번 : 루시와 엘라 찾기
SELECT ANIMAL_ID,NAME,SEX_UPON_INTAKE
FROM ANIMAL_INS
WHERE NAME IN ('Lucy', 'Ella', 'Pickle', 'Rogan', 'Sabrina', 'Mitty')

2번 : 이름에 el이 들어가는 동물 찾기
SELECT ANIMAL_ID,NAME
FROM ANIMAL_INS
WHERE NAME LIKE '%EL%' AND ANIMAL_TYPE = 'DOG'
ORDER BY NAME

3번 : 동물 수 구하기
SELECT count(ANIMAL_ID)
FROM ANIMAL_INS