본문 바로가기
반응형

oracle77

[프로그래머스 - ORACLE] 우유와 요거트가 담긴 장바구니 CREATE 문 CREATE TABLE CART_PRODUCTS ( IDNUMBER, CART_IDNUMBER, NAMEVARCHAR(30) PRICENUMBER ) 내 풀이 SELECT A.CART_ID FROM CART_PRODUCTS A INNER JOIN CART_PRODUCTS B ON A.CART_ID = B.CART_ID AND A.NAME = 'Milk' AND B.NAME = 'Yogurt' ORDER BY CART_ID ASC 2023. 3. 23.
[프로그래머스 - ORACLE] 입양 시각 구하기(2) CREATE 문 CREATE TABLE ANIMAL_OUTS ( ANIMAL_IDVARCHAR(50)NOT NULL, ANIMAL_TYPEVARCHAR(50)NOT NULL, DATETIMETIMESTAMPNOT NULL, NAMEVARCHAR(50)NULL, SEX_UPON_OUTCOMEVARCHAR(50)NOT NULL ); 내 풀이 SELECT A.HOUR, COUNT(B.HOUR) AS COUNT FROM (SELECT LEVEL - 1 AS HOUR FROM DUAL CONNECT BY LEVEL 2023. 3. 23.
[프로그래머스 - ORACLE] 보호소에서 중성화한 동물 CREATE 문 CREATE TABLE ANIMAL_INS ( ANIMAL_IDVARCHAR(50)NOT NULL PRIMARY KEY, ANIMAL_TYPEVARCHAR(50)NOT NULL, DATETIMETIMESTAMPNOT NULL, INTAKE_CONDITIONVARCHAR(50)NOT NULL, NAMEVARCHAR(50)NULL, SEX_UPON_INTAKEVARCHAR(50)NOT NULL ); CREATE TABLE ANIMAL_OUTS ( ANIMAL_IDVARCHAR(50)NOT NULL, ANIMAL_TYPEVARCHAR(50)NOT NULL, DATETIMETIMESTAMPNOT NULL, NAMEVARCHAR(50)NULL, SEX_UPON_OUTCOMEVARCHAR(50)NO.. 2023. 3. 23.
[프로그래머스 - ORACLE] 특정 기간동안 대여 가능한 자동차들의 대여비용 구하기 CREATE 문 CREATE TABLE CAR_RENTAL_COMPANY_CAR ( CAR_IDNUMBER NOT NULL, CAR_TYPEVARCHAR(255)NOT NULL, DAILY_FEENUMBER NOT NULL, OPTIONSVARCHAR(255)NOT NULL ); CREATE TABLE CAR_RENTAL_COMPANY_RENTAL_HISTORY ( HISTORY_IDNUMBERNOT NULL, CAR_IDNUMBERNOT NULL, START_DATEDATENOT NULL, END_DATEDATENOT NULL ); CREATE TABLE CAR_RENTAL_COMPANY_DISCOUNT_PLAN ( PLAN_IDNUMBER NOT NULL, CAR_TYPEVARCHAR(255)NOT .. 2023. 3. 22.
[프로그래머스 - 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.
반응형