๐ Database Design Process
1. ์๊ตฌ์ฌํญ ์์ง ๋ฐ ๋ถ์
2. Conceptual Design
3. Logical Design(or Data model mapping
4. Physical Design
๐โ๏ธ Entity-Relationship(ER) model
๋ฐ์ดํฐ๋ฅผ Entity, Relationship, Attribute ๋ก ํํ
Entity
ER model์ ๊ธฐ๋ณธ ์ปจ์ ์ผ๋ก, ๊ตฌ์ฒด์ ์ธ ๊ฐ์ฒด๋ฅผ ์๋ฏธํ๋ค.
- Entity Type : ๋น์ทํ ์์ฑ์ ๊ฐ์ง entity์ ํ์
(schema ๊ฐ์ ๋๋)
ex) EMPLOYEE, COMPANY
Weak Entity Type
์๊ธฐ ์์ ์ ์ํ key attribute๋ฅผ ๊ฐ์ง ์๋ entity type์ผ๋ก ํญ์ total participation์ ๋งบ์
( ER diagram์์ ๋ค๋ชจ ๋ ๊ฐ๋ก ํํ )
- partial key : weak entity๋ฅผ ์๋ณํ ์ ์๋ attribute๋ก, owner entity type์ key์ ํฉ์ณ์ ํํ๋์ด์ผ ํจ. (์ ์ ๋ฐ์ค๋ก ํํ)
- Entity Set : ํน์ ํ ์๊ฐ์ ๋ฐ์ดํฐ๋ฒ ์ด์ค์ ์๋ ํน์ entity type์ entity ์งํฉ (state ๊ฐ์ ๋๋)
ex) EMPLOYEE: e1, e2, ...
Attribute
entity๋ฅผ ์ค๋ช
ํ๋ ํน์ฑ์ผ๋ก, entity๋ ๊ฐ๊ฐ attribute๋ง๋ค ํน์ ํ ๊ฐ์ ๊ฐ์ง๋ค.
๊ฐ๊ฐ์ attribute๋ value set(or data type)์ ๊ฐ์ง๋ค.
Attribute Type
Simple (atomic)
ex) SSNComposite : attribute๊ฐ ์ฌ๋ฌ ๊ฐ์ ์์๋ค๋ก ์ด๋ฃจ์ด์ง ๊ฒฝ์ฐ
ex) Name(FirstName, LastName)Multi-valued : attribute๊ฐ ์ฌ๋ฌ ๊ฐ์ value๋ฅผ ๊ฐ์ง๋ ๊ฒฝ์ฐ
ex) {Color}
- Stored attribute
: ๊ฐ์ด ์ง์ ์ ์ฅ๋ attribute - Derived attribute
: ์ ์ฅ๋ ๊ฐ์ผ๋ก๋ถํฐ ํ์๋๋ attribute - Complex attribute
: composite attribute์ multi-valued attribute์ ์ค์ฒฉ - Key attribute
: ๊ฐ entity๊ฐ ๊ณ ์ ํ ๊ฐ์ ๊ฐ์ง๊ณ , ๊ณ ์ ํ๊ฒ ์๋ณ๋ ์ ์๋ ํน์ฑ (ํ๋ ์ด์ ๊ฐ์ง ์ ์์) - Value Sets (Domains) of Attribute
: attribute๋ง๋ค ๊ฐ๋ค์ด ๊ฐ์ ธ์ผ ๋๋ domain
ex) ๋ ์ง์ ๊ฒฝ์ฐ์๋ MM-DD-YYYY ๊ฐ์ ๊ฒฝ์ฐ๊ฐ domain
Relationship
๋ ์ด์์ ๊ตฌ๋ณ๋๋ entity๋ค์ ํน์ ํ ์๋ฏธ๋ก ์ฐ๊ด์ํค๋ ๊ฒ
- Relationship type R (๊ด๊ณ ์ ํ) : entity๋ค์ด ์ด๋ป๊ฒ ์ฐ๊ด๋์ด ์๋์ง์ ๋ํ ์ ํ
ex) WORKS_ON, WORKS_FOR - Relationship set R (๊ด๊ณ ์งํฉ) : relationship instance๋ค์ ์งํฉ
Degree of relationship type
: relationship์ ์ฐธ์ฌํ๊ณ ์๋ entity type์ ์
ex) Unary (1) (for self), Binary (2) (involving two), Tertiary (about three), …
๐ง Structural Constraints on Binary Relationship Types
- Cardinality ratio
entity๊ฐ ์ฐธ์ฌํ๋ relationship instance๋ค์ ์ต๋ ์ ์ง์
ex) 1:1, 1:N, N:1, M:N - Participation constraint
๊ด๊ณ๋ฅผ ๋งบ๋ ๋ entity type์ ๋ํด ํ entity๊ฐ ์กด์ฌํ๋ ค๋ฉด ๋ค๋ฅธ entity์ ์์กดํด์ผ ํ๋์ง ์ฌ๋ถ๋ฅผ ๋ํ๋ (์ต์ ์)- Total Participation : ๋ชจ๋ ์ฐธ์ฌ (double line์ผ๋ก ํํ)
- Partial Participation : ์ผ๋ถ ์ฐธ์ฌ (double line์ผ๋ก ํํ)
'CS > Database' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[Database] SQL ๊ธฐ์ด (1) | 2023.01.22 |
---|---|
[Database] ER-to-Relational Mapping (0) | 2023.01.22 |
[Database] Relational Model (0) | 2023.01.22 |
[Database] Data Model & Schema (0) | 2023.01.22 |
[Database] DB? DBMS?? (0) | 2023.01.22 |