๐Ÿ’ฏ Coding Test/SQL ํ…Œ์ŠคํŠธ

1) ๋ฌธ์ œ ์„ค๋ช… ANIMAL_INS ํ…Œ์ด๋ธ”์€ ๋™๋ฌผ ๋ณดํ˜ธ์†Œ์— ๋“ค์–ด์˜จ ๋™๋ฌผ์˜ ์ •๋ณด๋ฅผ ๋‹ด์€ ํ…Œ์ด๋ธ”์ž…๋‹ˆ๋‹ค. ANIMAL_INS ํ…Œ์ด๋ธ” ๊ตฌ์กฐ๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์œผ๋ฉฐ, ANIMAL_ID, ANIMAL_TYPE, DATETIME, INTAKE_CONDITION, NAME, SEX_UPON_INTAKE๋Š” ๊ฐ๊ฐ ๋™๋ฌผ์˜ ์•„์ด๋””, ์ƒ๋ฌผ ์ข…, ๋ณดํ˜ธ ์‹œ์ž‘์ผ, ๋ณดํ˜ธ ์‹œ์ž‘ ์‹œ ์ƒํƒœ, ์ด๋ฆ„, ์„ฑ๋ณ„ ๋ฐ ์ค‘์„ฑํ™” ์—ฌ๋ถ€๋ฅผ ๋‚˜ํƒ€๋ƒ…๋‹ˆ๋‹ค. Column name Type Nullable ANIMAL_ID VARCHAR(N) FALSE ANIMAL_TYPE VARCHAR(N) FALSE DATETIME DATETIME FALSE INTAKE_CONDITION VARCHAR(N) FALSE NAME VARCHAR(N) TRUE SEX_UPON_INTAKE ..
1) ๋ฌธ์ œ ์„ค๋ช… ANIMAL_INS ํ…Œ์ด๋ธ”์€ ๋™๋ฌผ ๋ณดํ˜ธ์†Œ์— ๋“ค์–ด์˜จ ๋™๋ฌผ์˜ ์ •๋ณด๋ฅผ ๋‹ด์€ ํ…Œ์ด๋ธ”์ž…๋‹ˆ๋‹ค. ANIMAL_INS ํ…Œ์ด๋ธ” ๊ตฌ์กฐ๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์œผ๋ฉฐ, ANIMAL_ID, ANIMAL_TYPE, DATETIME, INTAKE_CONDITION, NAME, SEX_UPON_INTAKE๋Š” ๊ฐ๊ฐ ๋™๋ฌผ์˜ ์•„์ด๋””, ์ƒ๋ฌผ ์ข…, ๋ณดํ˜ธ ์‹œ์ž‘์ผ, ๋ณดํ˜ธ ์‹œ์ž‘ ์‹œ ์ƒํƒœ, ์ด๋ฆ„, ์„ฑ๋ณ„ ๋ฐ ์ค‘์„ฑํ™” ์—ฌ๋ถ€๋ฅผ ๋‚˜ํƒ€๋ƒ…๋‹ˆ๋‹ค. Column name Type Nullable ANIMAL_ID VARCHAR(N) FALSE ANIMAL_TYPE VARCHAR(N) FALSE DATETIME DATETIME FALSE INTAKE_CONDITION VARCHAR(N) FALSE NAME VARCHAR(N) TRUE SEX_UPON_INTAKE ..
1) ๋ฌธ์ œ ์„ค๋ช… ๋‹ค์Œ์€ ๊ณ ๊ฐ์˜ ์ •๋ณด๋ฅผ ๋‹ด์€ MEMBER_PROFILEํ…Œ์ด๋ธ”๊ณผ ์‹๋‹น์˜ ๋ฆฌ๋ทฐ ์ •๋ณด๋ฅผ ๋‹ด์€ REST_REVIEW ํ…Œ์ด๋ธ”์ž…๋‹ˆ๋‹ค. MEMBER_PROFILE ํ…Œ์ด๋ธ”์€ ๋‹ค์Œ๊ณผ ๊ฐ™์œผ๋ฉฐ MEMBER_ID, MEMBER_NAME, TLNO, GENDER, DATE_OF_BIRTH๋Š” ํšŒ์› ID, ํšŒ์› ์ด๋ฆ„, ํšŒ์› ์—ฐ๋ฝ์ฒ˜, ์„ฑ๋ณ„, ์ƒ๋…„์›”์ผ์„ ์˜๋ฏธํ•ฉ๋‹ˆ๋‹ค. Column name Type Nullable MEMBER_ID VARCHAR(100) FALSE MEMBER_NAME VARCHAR(50) FALSE TLNO VARCHAR(50) TRUE GENDER VARCHAR(1) TRUE DATE_OF_BIRTH DATE TRUE REST_REVIEW ํ…Œ์ด๋ธ”์€ ๋‹ค์Œ๊ณผ ๊ฐ™์œผ๋ฉฐ REVIEW_ID, REST_ID, ME..
1) ๋ฌธ์ œ ์„ค๋ช… ๋‹ค์Œ์€ ์•„์ด์Šคํฌ๋ฆผ ๊ฐ€๊ฒŒ์˜ ์ƒ๋ฐ˜๊ธฐ ์ฃผ๋ฌธ ์ •๋ณด๋ฅผ ๋‹ด์€ FIRST_HALF ํ…Œ์ด๋ธ”๊ณผ 7์›”์˜ ์•„์ด์Šคํฌ๋ฆผ ์ฃผ๋ฌธ ์ •๋ณด๋ฅผ ๋‹ด์€ JULY ํ…Œ์ด๋ธ”์ž…๋‹ˆ๋‹ค. FIRST_HALF ํ…Œ์ด๋ธ” ๊ตฌ์กฐ๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์œผ๋ฉฐ, SHIPMENT_ID, FLAVOR, TOTAL_ORDER๋Š” ๊ฐ๊ฐ ์•„์ด์Šคํฌ๋ฆผ ๊ณต์žฅ์—์„œ ์•„์ด์Šคํฌ๋ฆผ ๊ฐ€๊ฒŒ๊นŒ์ง€์˜ ์ถœํ•˜ ๋ฒˆํ˜ธ, ์•„์ด์Šคํฌ๋ฆผ ๋ง›, ์ƒ๋ฐ˜๊ธฐ ์•„์ด์Šคํฌ๋ฆผ ์ด์ฃผ๋ฌธ๋Ÿ‰์„ ๋‚˜ํƒ€๋ƒ…๋‹ˆ๋‹ค. FIRST_HALF ํ…Œ์ด๋ธ”์˜ ๊ธฐ๋ณธ ํ‚ค๋Š” FLAVOR์ž…๋‹ˆ๋‹ค. FIRST_HALFํ…Œ์ด๋ธ”์˜ SHIPMENT_ID๋Š” JULYํ…Œ์ด๋ธ”์˜ SHIPMENT_ID์˜ ์™ธ๋ž˜ ํ‚ค์ž…๋‹ˆ๋‹ค. Column name Type Nullable NAME TYPE NULLABLE SHIPMENT_ID INT(N) FALSE FLAVOR VARCHAR(N) FALSE..
1) ๋ฌธ์ œ ์„ค๋ช… ์–ด๋Š ํ•œ ๊ฒŒ์ž„์—์„œ ์‚ฌ์šฉ๋˜๋Š” ์•„์ดํ…œ๋“ค์€ ์—…๊ทธ๋ ˆ์ด๋“œ๊ฐ€ ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค. 'ITEM_A'->'ITEM_B'์™€ ๊ฐ™์ด ์—…๊ทธ๋ ˆ์ด๋“œ๊ฐ€ ๊ฐ€๋Šฅํ•  ๋•Œ'ITEM_A'๋ฅผ 'ITEM_B'์˜ PARENT ์•„์ดํ…œ,PARENT ์•„์ดํ…œ์ด ์—†๋Š” ์•„์ดํ…œ์„ ROOT ์•„์ดํ…œ์ด๋ผ๊ณ  ํ•ฉ๋‹ˆ๋‹ค. ์˜ˆ๋ฅผ ๋“ค์–ด 'ITEM_A'->'ITEM_B'->'ITEM_C' ์™€ ๊ฐ™์ด ์—…๊ทธ๋ ˆ์ด๋“œ๊ฐ€ ๊ฐ€๋Šฅํ•œ ์•„์ดํ…œ์ด ์žˆ๋‹ค๋ฉด'ITEM_C'์˜ PARENT ์•„์ดํ…œ์€ 'ITEM_B','ITEM_B'์˜ PARENT ์•„์ดํ…œ์€ 'ITEM_A', ROOT ์•„์ดํ…œ์€ 'ITEM_A'๊ฐ€ ๋ฉ๋‹ˆ๋‹ค. ๋‹ค์Œ์€ ํ•ด๋‹น ๊ฒŒ์ž„์—์„œ ์‚ฌ์šฉ๋˜๋Š” ์•„์ดํ…œ ์ •๋ณด๋ฅผ ๋‹ด์€ ITEM_INFO ํ…Œ์ด๋ธ”๊ณผ ์•„์ดํ…œ ๊ด€๊ณ„๋ฅผ ๋‚˜ํƒ€๋‚ธ ITEM_TREE ํ…Œ์ด๋ธ”์ž…๋‹ˆ๋‹ค. ITEM_INFO ํ…Œ์ด๋ธ”์€ ๋‹ค์Œ๊ณผ ๊ฐ™์œผ๋ฉฐ, ITEM_ID..
1) ๋ฌธ์ œ ์„ค๋ช… ANIMAL_INS ํ…Œ์ด๋ธ”์€ ๋™๋ฌผ ๋ณดํ˜ธ์†Œ์— ๋“ค์–ด์˜จ ๋™๋ฌผ์˜ ์ •๋ณด๋ฅผ ๋‹ด์€ ํ…Œ์ด๋ธ”์ž…๋‹ˆ๋‹ค. ANIMAL_INS ํ…Œ์ด๋ธ” ๊ตฌ์กฐ๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์œผ๋ฉฐ, ANIMAL_ID, ANIMAL_TYPE, DATETIME, INTAKE_CONDITION, NAME, SEX_UPON_INTAKE๋Š” ๊ฐ๊ฐ ๋™๋ฌผ์˜ ์•„์ด๋””, ์ƒ๋ฌผ ์ข…, ๋ณดํ˜ธ ์‹œ์ž‘์ผ, ๋ณดํ˜ธ ์‹œ์ž‘ ์‹œ ์ƒํƒœ, ์ด๋ฆ„, ์„ฑ๋ณ„ ๋ฐ ์ค‘์„ฑํ™” ์—ฌ๋ถ€๋ฅผ ๋‚˜ํƒ€๋ƒ…๋‹ˆ๋‹ค. NAME TYPE NULLABLE ANIMAL_ID VARCHAR(N) FALSE ANIMAL_TYPE VARCHAR(N) FALSE DATETIME DATETIME FALSE INTAKE_CONDITION VARCHAR(N) FALSE NAME VARCHAR(N) TRUE SEX_UPON_INTAKE VARCHAR..
1) ๋ฌธ์ œ ์„ค๋ช… ๋‹ค์Œ์€ ์‹ํ’ˆ์ฐฝ๊ณ ์˜ ์ •๋ณด๋ฅผ ๋‹ด์€ FOOD_WAREHOUSE ํ…Œ์ด๋ธ”์ž…๋‹ˆ๋‹ค. FOOD_WAREHOUSE ํ…Œ์ด๋ธ”์€ ๋‹ค์Œ๊ณผ ๊ฐ™์œผ๋ฉฐ WAREHOUSE_ID, WAREHOUSE_NAME, ADDRESS, TLNO, FREEZER_YN๋Š” ์ฐฝ๊ณ  ID, ์ฐฝ๊ณ  ์ด๋ฆ„, ์ฐฝ๊ณ  ์ฃผ์†Œ, ์ „ํ™”๋ฒˆํ˜ธ, ๋ƒ‰๋™์‹œ์„ค ์—ฌ๋ถ€๋ฅผ ์˜๋ฏธํ•ฉ๋‹ˆ๋‹ค. Column name Type Nullable WAREHOUSE_ID VARCHAR(10) FALSE WAREHOUSE_NAME VARCHAR(20) FALSE ADDRESS VARCHAR(100) TRUE TLNO VARCHAR(20) TRUE FREEZER_YN VARCHAR(1) TRUE 2) ๋ฌธ์ œ FOOD_WAREHOUSE ํ…Œ์ด๋ธ”์—์„œ ๊ฒฝ๊ธฐ๋„์— ์œ„์น˜ํ•œ ์ฐฝ๊ณ ์˜ ID, ์ด๋ฆ„, ์ฃผ์†Œ, ๋ƒ‰๋™์‹œ์„ค..
1) ๋ฌธ์ œ ์„ค๋ช… ๋‚š์‹œ์•ฑ์—์„œ ์‚ฌ์šฉํ•˜๋Š” FISH_INFO ํ…Œ์ด๋ธ”์€ ์žก์€ ๋ฌผ๊ณ ๊ธฐ๋“ค์˜ ์ •๋ณด๋ฅผ ๋‹ด๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. FISH_INFO ํ…Œ์ด๋ธ”์˜ ๊ตฌ์กฐ๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์œผ๋ฉฐ ID, FISH_TYPE, LENGTH, TIME์€ ๊ฐ๊ฐ ์žก์€ ๋ฌผ๊ณ ๊ธฐ์˜ ID, ๋ฌผ๊ณ ๊ธฐ์˜ ์ข…๋ฅ˜(์ˆซ์ž), ์žก์€ ๋ฌผ๊ณ ๊ธฐ์˜ ๊ธธ์ด(cm), ๋ฌผ๊ณ ๊ธฐ๋ฅผ ์žก์€ ๋‚ ์งœ๋ฅผ ๋‚˜ํƒ€๋ƒ…๋‹ˆ๋‹ค. Column name Type Nullable ID INTEGER FALSE FISH_TYPE INTEGER FALSE LENGTH FLOAT TRUE TIME DATE FALSE ๋‹จ, ์žก์€ ๋ฌผ๊ณ ๊ธฐ์˜ ๊ธธ์ด๊ฐ€ 10cm ์ดํ•˜์ผ ๊ฒฝ์šฐ์—๋Š” LENGTH ๊ฐ€ NULL ์ด๋ฉฐ, LENGTH ์— NULL ๋งŒ ์žˆ๋Š” ๊ฒฝ์šฐ๋Š” ์—†์Šต๋‹ˆ๋‹ค. FISH_NAME_INFO ํ…Œ์ด๋ธ”์€ ๋ฌผ๊ณ ๊ธฐ์˜ ์ด๋ฆ„์— ๋Œ€ํ•œ ์ •๋ณด๋ฅผ ๋‹ด๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. ..
Dev_sHu
'๐Ÿ’ฏ Coding Test/SQL ํ…Œ์ŠคํŠธ' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๊ธ€ ๋ชฉ๋ก (2 Page)