[프로그래머스 - ORACLE] 년, 월, 성별 별 상품 구매 회원 수 구하기
CREATE 문 CREATE TABLE USER_INFO ( USER_IDNUMBER NOT NULL, GENDERNUMBER NULL, AGENUMBER NULL, JOINEDDATENOT NULL ) CREATE TABLE ONLINE_SALE ( ONLINE_SALE_IDNUMBER NOT NULL, USER_IDNUMBER NOT NULL, PRODUCT_IDNUMBER NOT NULL, SALES_AMOUNTNUMBER NOT NULL, SALES_DATEDATENOT NULL ) 내 풀이 SELECT TO_NUMBER(TO_CHAR(S.SALES_DATE, 'YYYY'))AS YEAR, TO_NUMBER(TO_CHAR(S.SALES_DATE, 'MM'))AS MONTH, I.GENDER AS ..
2023. 3. 23.
[프로그래머스 - ORACLE] 그룹별 조건에 맞는 식당 목록 출력하기
CREATE 문 CREATE TABLE MEMBER_PROFILE ( MEMBER_IDVARCHAR(100)NOT NULL, MEMBER_NAMEVARCHAR(50)NOT NULL, TLNOVARCHAR(50)NULL, GENDERVARCHAR(1)NULL, DATE_OF_BIRTHDATENULL ) CREATE TABLE REST_REVIEW ( REVIEW_IDVARCHAR(10)NOT NULL, REST_IDVARCHAR(10)NULL, MEMBER_IDVARCHAR(100)NULL, REVIEW_SCORENUMBERNULL, REVIEW_TEXTVARCHAR(1000)NULL, REVIEW_DATEDATENULL ) 내 풀이 SELECT P.MEMBER_NAME, R.REVIEW_TEXT, TO_..
2023. 3. 23.
[프로그래머스 - ORACLE] 서울에 위치한 식당 목록 출력하기
CREATE 문 CREATE TABLE REST_INFO ( REST_IDVARCHAR(5)NOT NULL, REST_NAMEVARCHAR(50)NOT NULL, FOOD_TYPEVARCHAR(20)NULL, VIEWSNUMBERNULL, FAVORITESNUMBERNULL, PARKING_LOTVARCHAR(1)NULL, ADDRESSVARCHAR(100)NULL, TELVARCHAR(100)NULL ) CREATE TABLE REST_REVIEW ( REVIEW_IDVARCHAR(10)NOT NULL, REST_IDVARCHAR(10)NULL, MEMBER_IDVARCHAR(100)NULL, REVIEW_SCORENUMBERNULL, REVIEW_TEXTVARCHAR(1000)NULL, REVIEW_..
2023. 3. 23.
[프로그래머스 - ORACLE] 5월 식품들의 총매출 조회하기
CREATE 문 CREATE TABLE FOOD_PRODUCT ( PRODUCT_IDVARCHAR(10)NOT NULL, PRODUCT_NAMEVARCHAR(50)NOT NULL, PRODUCT_CDVARCHAR(10)NULL, CATEGORYVARCHAR(10)NULL, PRICENUMBERNULL ) CREATE TABLE FOOD_ORDER ( ORDER_IDVARCHAR(10)NOT NULL, PRODUCT_IDVARCHAR(5)NOT NULL, AMOUNTNUMBERNOT NULL, PRODUCE_DATEDATENULL, IN_DATEDATENULL, OUT_DATEDATENULL, FACTORY_IDVARCHAR(10)NOT NULL, WAREHOUSE_IDVARCHAR(10)NOT NULL ..
2023. 3. 23.
[프로그래머스 - ORACLE] 식품분류별 가장 비싼 식품의 정보 조회하기
CREATE 문 CREATE TABLE FOOD_PRODUCT ( PRODUCT_IDVARCHAR(10)NOT NULL, PRODUCT_NAMEVARCHAR(50)NOT NULL, PRODUCT_CDVARCHAR(10)NULL, CATEGORYVARCHAR(10)NULL, PRICENUMBERNULL ) 내 풀이 SELECT CATEGORY, PRICE AS MAX_PRICE, PRODUCT_NAME FROM FOOD_PRODUCT WHERE (CATEGORY, PRICE) IN (SELECT CATEGORY, MAX(PRICE) AS MAX_PRICE FROM FOOD_PRODUCT WHERE CATEGORY IN ('과자' , '국' , '식용유' ,'김치') GROUP BY CATEGORY ) OR..
2023. 3. 23.