프로그래머스 SQL SUM, MAX, MIN 문제 정답 모음

HR·2022년 12월 13일
0
post-thumbnail

가장 비싼 상품 구하기

SELECT max(price) as MAX_PRICE
from product

가격이 제일 비싼 식품의 정보 출력하기

SELECT *
from food_product
where price = (select max(price) from food_product)

최댓값 구하기

SELECT datetime as "시간"
from animal_ins
where datetime = (select max(datetime) from animal_ins)

최솟값 구하기

SELECT min(datetime) as 시간
from animal_ins

동물 수 구하기

SELECT count(*)
from animal_ins

중복 제거하기

SELECT count( distinct(name) )
from animal_ins
where name is not null

0개의 댓글