문제
MYSQL
내가 작성한 정답 - substring, substr 모두 사용가능
SELECT substring(product_code,1,2) category, count(product_id) products
from product
group by 1
order by 1 asc
SELECT substr(product_code,1,2) category, count(product_id) products
from product
group by 1
order by 1 asc
ORACLE
내가 작성한 정답
SELECT substr(product_code,1,2) category, count(product_id) products
from product
group by substr(product_code,1,2)
order by category
SUBSTR(string, start_position, length)
Share article