SQL 고득점 Kit - String, Date Level2 - 카테고리 별 상품 개수 구하기 - mysql

Purple·2022년 10월 26일
0

sql

목록 보기
8/22

https://school.programmers.co.kr/learn/challenges?page=1&languages=mysql&order=recent

select substr(product_code, 1, 2) as category, count(*) as products
from product
group by substr(product_code, 1, 2)
order by substr(product_code, 1, 2) asc

substr(<컬럼명>, start 위치, end 위치)

profile
안녕하세요.

0개의 댓글