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

๐“ก๐“ธ๐“ธ๐“ถ5: ๐’ฆ๐‘œ๐“‡๐‘’๐’ถ ๐’ฐ๐“ƒ๐’พ๐“‹/Database(COSE371)

(6)
[๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค] CH7. Relational Database Design(Normalization) 0. Intro 1. Features of Good Relational Design ์šฐ๋ฆฌ๊ฐ€ instructor ๊ณผ department๋ฅผ in_dep์ด๋ผ๋Š” table๋กœ ํ•ฉ์ณค๋‹ค๊ณ  ์ƒ๊ฐํ•ด๋ณด์ž. ์ด๋Ÿฌ๋ฉด ๊ฐ™์€ dept ์ •๋ณด๊ฐ€ ๊ณ„์† ๋ฐ˜๋ณตํ•ด์„œ ๋“ค์–ด๊ฐ€๊ณ , ๋งŒ์•ฝ ํ•™๊ณผ๊ฐ€ ์ƒˆ๋กœ ๋งŒ๋“ค์–ด ์กŒ์„ ๋•Œ ๊ต์ˆ˜์ž๊ฐ€ ์•„์ง ์—†๋‹ค๋ฉด null๊ฐ’์œผ๋กœ ๋„ฃ์–ด ์ถ”๊ฐ€ํ•ด์•ผ ํ•˜๋Š” ๋ฌธ์ œ๋„ ๋ฐœ์ƒํ•œ๋‹ค. ์‹ฌ์ง€์–ด id๊ฐ€ not null์ด๋ฉด ์ด๊ฒƒ๋„ ๋ถˆ๊ฐ€๋Šฅ ํ•˜๋‹ค. ์ฆ‰, ๋ฌด์กฐ๊ฑด table์„ ํ•ฉ์นœ๋‹ค๊ณ  ์ข‹์€ ๊ฒƒ์ด ์•„๋‹ˆ๋‹ค. Combined schema without repetition ๊ทธ๋Ÿฌ๋‚˜ ํ•ฉ์นœ๋‹ค๊ณ  ๋˜ ๋ฌด์กฐ๊ฑด ์ค‘๋ณต์ด ์ƒ๊ธฐ๋Š” ๊ฑด ์•„๋‹ˆ๋‹ค. sec_class์™€ section์„ ํ•ฉ์น  ๊ฒฝ์šฐ ์ค‘๋ณต๋˜๋Š” ์ •๋ณด๊ฐ€ ์—†๊ฒŒ ๋œ๋‹ค. 2. Decomposition : table ์ชผ๊ฐœ๊ธฐ. ์šฐ๋ฆฌ๊ฐ€ ์•ž..
[๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค] CH6. Database Design Using the E-R Model 0. INTRO 1. Design Phases Initial phase : ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ์‚ฌ์šฉ์ž๊ฐ€ ํ•„์š”๋กœ ํ•˜๋Š” ๋ฐ์ดํ„ฐ๋ฅผ ํŒŒ์•…ํ•˜๊ธฐ Second phase : conceptual design data model์„ ์„ ํƒํ•ด์„œ ๊ฐœ๋…์„ ์ ์šฉํ•œ๋‹ค. requirements๋ฅผ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์˜ conceptual schema๋กœ ๋ณ€ํ™˜ํ•œ๋‹ค. (ex. ER Model) ๊ฐœ๋ฐœ์ด ์™„๋ฃŒ๋œ conceptual schema๋Š” ๊ธฐ์—…์˜ ๊ธฐ๋Šฅ ์š”๊ตฌ ์‚ฌํ•ญ์„ ๋‚˜ํƒ€๋‚ธ๋‹ค. Final Phase : ์ถ”์ƒ์ ์ธ data model์„ ๊ธฐ๋ฐ˜์œผ๋กœ ๊ตฌํ˜„ํ•˜๊ธฐ Logical Design : ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์˜ ์Šคํ‚ค๋งˆ๋ฅผ ๊ฒฐ์ •ํ•œ๋‹ค. (conceptual schema(er diagram)์„ logical schema(relational schema)์— ๋Œ€์‘์‹œํ‚จ๋‹ค) Physica..
[๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค] CH4. Intermediate SQL Join Expressions ๋‘ ๊ฐœ์˜ relation์„ join ํ•ด์„œ ์ƒˆ๋กœ์šด relation์„ ๋ฐ˜ํ™˜ํ•˜๋Š” ๊ฒƒ Cartesian product!! ๋ณดํ†ต from clause์—์„œ ์‚ฌ์šฉ๋จ Join conditions Using Clause -> attribution์„ ์ž˜๋ชป ํ•ฉ์น˜๋Š” ๊ฒฝ์šฐ๋ฅผ ๋ง‰๊ธฐ ์œ„ํ•ด ์”€! select name, title from (student natural join takes) join course using (course_id)์ด๋ ‡๊ฒŒ join ์–ด์ฉŒ๊ตฌ using (์ €์ฉŒ๊ตฌ) ๋ผ๊ณ  ๋ช…์‹œํ•ด์„œ ๊ทธ๋ƒฅ ๊ฒน์น˜๋Š” ๊ฑธ ๋‹ค ํ•ฉ์น˜๋Š” ๊ฒƒ์ด ์•„๋‹ˆ๋ผ, ํŠน์ • attribute๋ฅผ ๊ธฐ์ค€์œผ๋กœ join ํ•˜๊ฒ ๋‹ค๊ณ  ํ•ด์ฃผ๋Š” ๊ฒƒ! ์ด ๊ฒฝ์šฐ Duplication columns์€ ์ œ๊ฑฐ๋œ๋‹ค. Join Condition (on) ์ด pre..
[๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค] CH3. Introduction to SQL Overview 1. History SQL Parts DML DDL Domain Types in SQL : ์Šคํ‚ค๋งˆ๋ฅผ ๊ตฌ์„ฑํ•˜๋Š” attribute ์˜ ๊ฐ€๋Šฅํ•œ type๋“ค!! char(n) : ๊ธธ์ด๊ฐ€ n์œผ๋กœ ๊ณ ์ •๋œ ๋ฌธ์ž์—ด varchar(n) : ์ตœ๋Œ€ ๊ธธ์ด๊ฐ€ n์ธ ๊ฐ€๋ณ€์ ์ธ ๋ฌธ์ž์—ด int : ์ •์ˆ˜ smallint : ์ž‘์€ ์ •์ˆ˜ numeric(p,d) : ์ „์ฒด ์ž๋ฆฌ์ˆ˜๊ฐ€ p, ์†Œ์ˆซ์  ์•„๋ž˜ ์ž๋ฆฌ์ˆ˜๊ฐ€ d์ธ ์‹ค์ˆ˜ ex) numeric(3,1)์ด๋ฉด 44.5 (0) 3.12(X) 444.5(X) real, double, precision float(n) 1. Create Table Construct create table r (A1 D1, A2 D2, ... , An Dn, (integrity-constraint1), ... ..
[๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค] CH2. Introduction to Relation Model(1) superkey : tuple์„ ํŠน์ •์ง€์„ ์ˆ˜ ์žˆ๋Š” attribute ๋˜๋Š” attribute์˜ ์ง‘ํ•ฉ ๋ชจ๋‘ candidate key: primary key๊ฐ€ ๋  ์ˆ˜ ์žˆ๋Š” ํ›„๋ณดํ‚ค๋กœ, tuple์„ ํŠน์ •์ง€์„ ์ˆ˜ ์žˆ๋Š” super ํ‚ค ์ค‘ ์ตœ์†Œ์ธ ๊ฒƒ(๋ถˆํ•„์š”ํ•œ ๊ฒƒ ๋บ€ ๊ฒƒ) primary key : candidate key ์ค‘ ํ•˜๋‚˜ foreign key : ๋‹ค๋ฅธ relation์˜ pk๋ฅผ ์ฐธ์กฐํ•œ key
[๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค] CH1. Introduction database systems์„ ์จ์•ผ ํ•˜๋Š” ์ด์œ  1. Data redundancy and inconsistency : ๋ฐ์ดํ„ฐ ์ค‘๋ณต ๋ฐ ๋ถˆ์ผ์น˜๋ฅผ ๋ง‰๊ธฐ ์œ„ํ•ด. ๋ฐ์ดํ„ฐ๊ฐ€ ์—ฌ๋Ÿฌ ํŒŒ์ผ ํ˜•์‹์œผ๋กœ ์ €์žฅ๋˜๋ฏ€๋กœ ์„œ๋กœ ๋‹ค๋ฅธ ํŒŒ์ผ์— ์ •๋ณด๊ฐ€ ์ค‘๋ณต๋จ 2. Difficulty in accessing data : ๋””๋น„ ์•ˆ์“ฐ๋ฉด ๋ฐ์ดํ„ฐ ์ ‘๊ทผ์ด ์–ด๋ ค์›€ 3. Data isolation : ์—ฌ๋Ÿฌ ๋ฐ์ดํ„ฐ๋ฅผ ๋…๋ฆฝ์ ์œผ๋กœ ๊ด€๋ฆฌํ•˜๊ธฐ ์œ„ํ•ด ? 4. Integrity problems : ์ œ์•ฝ์กฐ๊ฑด์„ ์ถ”๊ฐ€ํ•˜๊ฑฐ๋‚˜ ๋ฐ”๊พธ๊ธฐ ์‰ฝ๊ฒŒ ํ•˜๊ธฐ ์œ„ํ•ด 5. Atomicity of updates : ์ค‘๊ฐ„์— ์˜ค๋ฅ˜๊ฐ€ ๋‚ฌ์„ ๋•Œ ์ฒ˜๋ฆฌํ•˜๊ธฐ ์œ„ํ•ด. (์ผ๋ถ€๋ถ„๋งŒ ์—…๋ฐ์ดํŠธ๋˜์–ด inconsistent state ๋  ์ˆ˜ ์žˆ์Œ) 6. Concurrent access by multiple user..