[프로그래머스 - ORACLE] 상품을 구매한 회원 비율 구하기
CREATE 문 CREATE TABLE USER_INFO ( USER_IDNUMBERNOT NULL, GENDERNUMBERNULL, AGENUMBERNULL, JOINEDDATENOT NULL ) CREATE TABLE ONLINE_SALE ( ONLINE_SALE_IDNUMBERNOT NULL, USER_IDNUMBERNOT NULL, PRODUCT_IDNUMBERNOT NULL, SALES_AMOUNTNUMBERNOT NULL, SALES_DATEDATENOT NULL ) 내 풀이 SELECT YEAR(O.SALES_DATE) AS YEAR, MONTH(O.SALES_DATE) AS MONTH, COUNT(DISTINCT(U.USER_ID)) AS PUCHASED_USERS, ROUND(COUNT(..
2023. 3. 22.
[프로그래머스 - ORACLE] 조건에 부합하는 중고거래 상태 조회하기
CREATE 문 CREATE TABLE USED_GOODS_BOARD ( BOARD_IDVARCHAR(5)NOT NULL, WRITER_IDVARCHAR(50)NOT NULL, TITLEVARCHAR(100)NOT NULL, CONTENTSVARCHAR(1000)NOT NULL, PRICENUMBERNOT NULL, CREATED_DATEDATENOT NULL, STATUSVARCHAR(10)NOT NULL, VIEWSNUMBERNOT NULL ) 내 풀이 SELECT BOARD_ID, WRITER_ID, TITLE, PRICE, CASE WHEN STATUS = 'DONE' THEN '거래완료' WHEN STATUS = 'SALE' THEN '판매중' WHEN STATUS = 'RESERVED' THE..
2023. 3. 22.