๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ

๐Ÿ“š ์ „๊ณต ๊ณต๋ถ€/DB๊ธฐ์ดˆ14

[DB] SQL ๋ฌด๊ฒฐ์„ฑ ์ œ์•ฝ์กฐ๊ฑด ์œ„๋ฐฐ ์˜ˆ์ œ company DB ์—ฐ์Šต๋ฌธ์ œ๋“ค. ์ด ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค๊ฐ€ ๊ต์œก์šฉ ์ž๋ฃŒ๋กœ ํ”ํ•˜๊ฒŒ ์“ฐ์ด๋Š” ๋“ฏ ํ•˜๋‹ค ๐Ÿ’ก [ ๊ฐœ์ฒด ๋ฌด๊ฒฐ์„ฑ : ํ‚ค๊ฐ’์ด null์ด๋ฉด ์•ˆ๋จ ] [ ์ฐธ์กฐ ๋ฌด๊ฒฐ์„ฑ : FK๊ฐ€ PK์— ์—†๋Š” ๊ฐ’์ด๋ฉด ์•ˆ๋จ ] ๋‹ค์Œ ๋ช…๋ น์ด ์–ด๋–ค ๋ฌด๊ฒฐ์„ฑ์„ ์œ„๋ฐ˜ํ•˜๋Š”์ง€ ์„ค๋ช…ํ•˜์‹œ์˜ค. 1) Insert into PROJECT. → DNUM=2์ด๊ณ  DNUMBER=2์™€ DEPACTION ๊ด€๊ณ„์— ํŠœํ”Œ์ด ์—†์œผ๋ฏ€๋กœ ์ฐธ์กฐ ๋ฌด๊ฒฐ์„ฑ์„ ์œ„๋ฐ˜. (์ฐธ์กฐํ•  ์ˆ˜ ์—†๋Š” FK๊ฐ’ 2๋ฅผ ๊ฐ€์ง€๊ฒŒ ๋˜๋ฏ€๋กœ) ์ œํ•œ ๋ฐฉ๋ฒ• (i) ์ƒˆ ํ”„๋กœ์ ํŠธ ํŠœํ”Œ ์‚ฝ์ž… ๊ฑฐ๋ถ€ (ii) ๋ถ€์„œ ๊ด€๊ณ„์—์„œ ์‹ ๊ทœ ํ”„๋กœ์ ํŠธ ํŠœํ”Œ์˜ DNUM ๊ฐ’์„ ๊ธฐ์กด DNUMBER ๊ฐ’์œผ๋กœ ๋ณ€๊ฒฝ (iii) DNUMBER=2์˜ ์ƒˆ ๋ถ€์„œ ํŠœํ”Œ์„ ์‚ฝ์ž…ํ•ฉ๋‹ˆ๋‹ค. 2) Insert into WORKS_ON. → ๊ฐœ์ฒด ๋ฌด๊ฒฐ์„ฑ ๋ฐ ์ฐธ์กฐ ๋ฌด๊ฒฐ์„ฑ์„ .. 2022. 10. 20.
[DB] Schema, DDL, DML ์ •๋ฆฌ The goal of Three-schema architecture is to separate the user applications and the physical DB. → ๋ชฉํ‘œ = ์‚ฌ์šฉ์ž ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜๊ณผ ๋ฌผ๋ฆฌ์  DB๋ฅผ ๋ถ„๋ฆฌํ•˜์—ฌ DB์˜ ๋…๋ฆฝ์„ฑ ํ™•๋ณด. Internal schema describes the physical storage structure of the DB. Conceptual schema describes the structure of the whole DB for a community of users. External schema describes the part of the DB that a particular user group is interested in and hides the r.. 2022. 10. 20.
728x90
๋ฐ˜์‘ํ˜•