สไลด์การออกแบบโครงสร้างฐานข้อมูลด้วย...

58
1 กกกกกกกกกกกกกกกกกกกกกกกกกกก กกกก E-R Model กกกกกกกกกก กกกกกกกกกกก E-R Model = Entity Relationship Model กกกกกกกกกกกกกกกกกกกกกกกก กกกกกกกก ERD (Entity Relationship Diagram)

Upload: know2pro

Post on 27-Sep-2015

15 views

Category:

Documents


3 download

DESCRIPTION

สไลด์การออกแบบโครงสร้างฐานข้อมูลด้วย E-R Model และการแปลงเป็นรีเลชัน

TRANSCRIPT

1.1.1

1

E-R Model

E-R Model = Entity Relationship Model

ERD

(Entity Relationship Diagram)

E-R Model

2

-

-

Entity Relationship Model (E-R Model)

2

(Entity)

(Relationship) Entity

3

E-R Diagram

4

5

E-R Diagram Chen Model

Entity

(, , , ,)

(, , , )

(, , ,)

(, , ,,)

Entity

6

Entity

(Entity)

(Property) (Attribute) Attribute

7

(Entity)

3

Regular Entity Entity Attribute Tuple

Weak Entity Entity Entity Attribute Entity Tuple

Composite Entity Entity Attribute Primary key 2 Entity Tuple Entity M:M 1:M

8

Regular Entity

9

Weak Entity

10

Weak Entity

11

Strong & Weak Entity

4500145002450011/4501450021/4501450011/4502450021/45020102

Student (Strong)

Subject (Strong)

Regis_Detail(Weak)

Composite Entity

12

Student

Subject

M

M

1

1

Learning

Attribute Property

Entity

13

Attribute

Attributes

Entity

Attributes

-

Attributes Attributes Entity

14

Attributes

15

Employee

Name

Emp_ID

Sex

Salary

Attributes

Attributes 6

1 Simple Attributes

Attributes ,

2 Composite Attributes

Simple Attributes

3 Key Attributes

Attributes Entity ()

ER Diagram Attributes Key

16

Attributes

4 Single - Valued Attributes

Property Attributes

5 Multi - Valued Attributes

Single

6 Derived Attributes

Property Property Property

17

Attribute Property

Simple Attribute

18

Attribute Property

Composite Attribute

19

Attribute Property

Key Attribute

20

Attribute Property

Single-Valued Attribute

Attribute Attribute

21

Attributes

22

Student

ID

Age

Name_Surname

Birthday

Sex

Name

Surname

Tel

Composite

key

Derived

Multi - Valued

(Relationship)

Entity 2 Entity

Entity Attributes

(Diamond)

Entity

23

(Relationship)

Relationship

24

Employee

Work_in

Department

Order

Of

Order_detail

Relationship

1. One-to-One Relationship

Entity Entity

25

Employee

Owner

1

1

Car

Relationship

2. One-to-Many Relationship

Entity Entity 1

26

Employee

Have

1

M

Car

Relationship

3. Many-to-Many Relationship

1 Entity Entity 1

27

Customer

Belong_to

M

N

Account

Relationship Connectivity : One to One , 1:1

28

1

1

Relationship Connectivity : One to Many, 1:M

29

1

M

Relationship Connectivity : Many to Many, M:N

30

M

N

E-R diagram Table

Strong Entity

31

Student

E-R diagram Table

Entity Composite Attribute

32

Student

E-R diagram Table

Entity Multi-value Attribute

33

Student

Tel 1

E-R diagram Table

Weak Entity

34

Timestamp

E-R diagram Table

(One to One, 1:1)

35

1

1

E-R diagram Table

(One to Many, 1:M)

36

1

M

E-R diagram Table

(Many to Many, M:N)

37

M

N

38

M:M 1:M

M

N

M

M

1

1

E-R Model

1.

39

2. Entity

Entity

Entity

Entity Entity

40

3. Entity

Entity

One to One Relationship

One to Many Relationship

Many to Many Relationship

41

4. Entity

(Attributes) Entity Attributes

Attributes

Composite Attributes

Derived Attributes

42

5. Primary Key Entity

Entity Entity

Primary Key

43

E-R Model

Ex

3 , ,

44

Entity

Entity Faculty

Entity Department

Entity Teacher

Entity Subject

45

Entity

46

1

M

1

1

M

M

47

1

M

M

M

1

1

Entity

Faculty

Department

48

49

Teacher

Subject

Primary Key Entity

Entity Faculty Faculty_ID

Entity Department Dep_ID

Entity Teacher Teacher_ID

Entity Subject Subject_ID

50

51

E-R Model

Ex ER-Diagram ABC

52

Entity

Entity Customer

Entity Employee

Entity Product

Entity TypeProduct

Entity Bill

53

Entity

54

Customer

1

M

Bill

Employee

1

M

Bill

TypeProduct

1

M

Product

55

Bill

M

M

Product

Bill

Bill_detail

M

M

Product

1

1

Entity

56

Employee

Emp_ID

Emp_name

salary

Product

Product_ID

Product_name

price

TypeProduct

TypeName

TypeID

57

Customer

Cus_ID

Cus_name

Address

Bill

Bill_No

Bill_date

Emp_ID

ER-Diagram

58

Bill_detail

Customer

Cus_ID

Cus_name

Address

Bill

Bill_No

Bill_date

Emp_ID

Employee

Emp_ID

Emp_name

salary

Product

Product_ID

Product_name

price

Bill_detail

1

M

1

M

1

M

1

M

Detail_ID

Product_ID

Bill_No

Amount

Price_s

TypeProduct

TypeID

TypeName

1

M

Student

SID

SName

GPA

Student

SIDSNameGPA

Student

SID

SName

GPA

FirstName

LastName

Student

SIDSNameGPA

FirstNameLastName

Student

SID

SName

GPA

FirstName

LastName

Student

SIDSNameGPA

FirstNameLastName

Student

SID

SName

GPA

Student

SIDSNameGPA

SID

SName

GPA

SIDSNameGPA

Student

SID

SName

GPA

FirstName

LastName

Student

SIDSNameGPA

FirstNameLastName

SID

FirstName

GPA

LastName

SIDFirstNameGPALastName

SID

FirstName

GPA

LastName

SIDFirstNameGPALastName

SID

Tel

SIDTel

stamp

Employee

EmpID

EName

Salary

stamp

TDate

T_In

T_out

TimeStamp

stampEmployee

EmpIDENameSalary

stamp

TDate

T_InT_out

TimeStamp

EmpID

TDate

T_Out

T_In

EmpIDTDateT_OutT_In

FacultyDepartmentUnder

DepartmentTeacherUnder

DepartmentSubjectUnder

Faculty

Department

Department

Under

Teacher

Under

Department

Subject

Under

Teacher

Leader

SubjectTeacher

M

Teaching

M

SubjectTeacherTeaching

Teacher

Leader

Subject

Teacher

M

Teaching

M

Subject

Teacher

Teaching

Faculty

Faculty_IDFaculty_Name

Department

Dep_IDDep_Name

Faculty

Faculty_ID

Faculty_Name

Department

Dep_ID

Dep_Name

Teacher

Teacher_ID

Teacher_Name

Salary

Subject

Subject_ID

Subject_Name

Unit

Teacher

Teacher_ID

Teacher_Name

Salary

Subject

Subject_ID

Subject_Name

Unit