ºÝºÝߣ

ºÝºÝߣShare a Scribd company logo
???????? ????????????????????? ?.2/4 ?????? 1-18-26-29-31-34-40
???????? ????????????????? (Relational Database) ???????? ?????????? ?
????????????????? (Relational Database Model) ??????????? ???????
?????????????????? Dr. E.F. Codd ????? ?????????????????????????
??????? ????????????????????????????????????????? ????????????????
?????????????????? ???? ????????????? ???????????????????? ???? ? ???
??????? ???????? ??????????????????? ????????????????????? ????????
entity ????????????????? ????? ??????????????? ??? attribute ??
???????????????? ????? ??????????????????????????????????????
entity
????????????????????????
????????
??? ???????? ?????????????????? (Table) ?????????????????????????????? ?????
?????????????????????? ?????????????????????????????? (Column) ?????
????????????????????????????????? ???????????????????????????????????
??????????????????????? (Set) ??????? ??????????????????????????????
???? ?????????????????
?????????? ???????????
???????? (Relation) ????? (Table)
?????? (Tuple)
??? (Row) ???? ????????
(Record) ???? ???????
??????????? (Attribute)
??????? (Column) ?????????
(Field)
?????????????? (Cardinality) ???????? (Number of rows)
???????????????? (Number of
attribute)
???????? (Primary key) ???????????? (Unique identifier)
????? (Domain)
????????????????? ????? (Pool of
legal values)
??????????????????????????????? R(???????????????????,????,???????
,???????) ???????????????????????????????????????????? ????????????? ???
? ???? ?? ???? ????????? ???????????????? ?????????????????????????
?????????????? ??????? ????????????????????????????????????? ???
?????????? ???? ???????????????????????? ?????(key)
??????????????????????????????? ?
???????????????????????
Dr.E.F.Codd ?? ??????????????????????????????????????? ???????? 3
?????? ????
1. ?????????????? ???????????? ??????? ?????
2. ????????????????????????????????? ????? ????? ?????
3. ??????????????????? ?????
???????????????????????????????????
????????????
Relation
?????? ?????????? ????????????????? ?????????????????????? 2 ????
??????? ??????? ?????? ?????????? ?????????????? ??????? (Relation)
??????? ? ?? Relation ????? ? ????????????????? ? ??????1) ????? Tuples
????? ? ???????????? (No duplicate tuples)
2) ??????????? Tuples ??????????????
3) ??????????? Attributes ??????????????
4) ?????? Attribute ??????????????? ? (Atomic) ??????? ??????? ????????
????????????????????????? ? ????? ??????????????????? ? ???????? ?
???? Relation ??????????????? ?????????????????????? Relation ?????????
?????? Normal form
5) ??????? ???????????? Attribute ?????????????? ???????????
????????
?????????????????? (Data Structure)
1) Relation ???? (Base Relation)
???? Relation ????????????????????????? ???????????????? ????????? ??????
??????? ??? Relation ????? ?Data Definition Language ???? ?? SQL
?????? CREATE TABLE ????????? ??? Relation ???? ?????????????????
???????? ???????????????????? ?? ?????????????? Relation ??????????
???????????????? ??????????? ?
2) ??? (View) ???????????????????????????? Relation ??????
(Virtual Relation)
???? Relation ???????? ??????????????? ???????? ?? ????????????? ????????
????????? ????? ???????????? ???????? ?? ??????????????????????????
?????????????????????????????????? Relation ???? ?????????
???????????? ?? ????? ????????? ???????????????????????
???? ????????? ????????? Relation ??????????????????????????????????
? ????????? ? ?????????? ?????
??????? Relations
?????? ???????????? ?????????? Relation ??????????????????????????
Table ???? ????? ??????????????? ????????????????????????? ????? ?????
?????????? ?????????? ?????? (Tuple) ????? ??????????????????? ??
???????? ??????????? (Attribute) ????????????? 4 ??????????? ??? SID,
Sname, GPA, Major ???????????????? ???????
Student(SID,Sname,GPA,Major)
?????????????????????????????????
???????????????????????????? ?????????????????????? ?? ????????????? ????????
?????????????????????????????????????????? ??????????????
????? (Domain)
??????????????????? ???????????????? ????? GPA ???????????????
?????? ??????????? ???????????????????? ??????????????????? 0 - 4 ???????
???? ??????????????? ??????????????? GPA ?????????? ?? ????????????
????????
????????????? (Simple key) ??????? key ?????????? ??? attribute ?????
?????????? (Combine key ???? Composite key) ??????? key ???
??????? ??? attribute ??????? 1 attribute
??????????? (Candidate Key) ???????????????????? ????????????????????
? ????? ????????????? ? ?????????????? ????????? Student ??? ??????????????????
??????????? ?????????????? ???????????? ???????? ???????????? ??????????
??????? ??????????????????????????????????? ???? ????? ????????????? ?
???????? (Primary Key) ???????????????????? ??????????????? ???????? ????????
???? ??????? ??????? ????? ??????????????????????????? ?????? ????????????????? ???
????????????????????? ??????????????????????????? ???????????? ??????????????
????????????????? ????????????????? ????????? ????????????????????????? ????
?????? ??????? ?????????? ????????????????? ???????????????????????
??????? (Alternate Key ???? Secondary key) ??????????????????? ???????? ?
???????????? ???? ?????????????? ??????????? ????????????????? ????????? ????
??????? ??????????????????????? ???????????? Alternate Key
???? (Key)
??????? Student ???????????????? SID ???????????????????? ???? ????????????
??????????? ?????? ????????????????? ??????????????????????????????????
Major ????????????????????????????????????????? Major ?????????? Major ????
? ????????????????????????? Major ????????? Student ??? ?????????????????
????? Major ?????????? Major ????????? Major ????????????????????????
Major
???????????? (Super key) ??????? attribute ???? ??????? attribute ???
??????????????????????? (Tuple) ?????????? ????? ? ???????????? ??? ???
??????????? ????? super key ????????? attributes
??????? (Foreign Key)
? ??????? ???????????????????? ??????? ????? ??????????? 2 ????? ???????????? ???
??????????? ??????????????? ????????????????????????????????????????? )3.3.1.
???????????????????????? (Entity Integrity Rule)
???????????????????????? ??????????? ????????????? ?? ???????????????? ??
???????? ??? ??????????? ???? "????????????????????????????????????????????? ???
???????????????????????? ?(Null Value)" ?????? ??????????????????????????????
(Identity) ?????????????? ????????????????????? ????????????????????????? ?
? 3.3.2. ?????????????????????????? (Referential Integrity Rule)
???????????????????? ?????? ?????????? ?????????????? ??????? ??????????
?????????????????????????? ?????? ???????? ???? "?????????????????????? ??? ?????
? ?????????????? ???????????? ????????????????????????? ?????????"
???????????????????????????????? ?? ????????????????? ???????? ????????
??????? ????????? ??????????????? ?????? ???? ????? ???????????????? ?????????
?????????? ??????????????????????? ????? ????????????????? 3.6 ?????????? ???
??????? ??????????????? Major ????????????? Major ?????????????????????????
??????? Student ?????? ????????????????? ???????????? ??????????? ???????? ???
??????????????? ????????????????? ??????????????
3.3. ?????????????????????????????????????
? 1. ? ?????????? ???? ????????????????????? ??????????
??????????????? ?? ?????????????????? ???????? ?????????
? ??????? ??????? ?
2. ???????? ???????? ???? ????????????????????? ?????????
?? ??????? ?????????? ???? ????? ????????????? ?????????? ?
??????? ?????????? ??????????????
3. ???????? ???????? ???? ????????????????????? ?????????
?? ????????? ???? ?????????????? ???? ?????????? ??????????
???????
??????????????????
? 1. ? ??????????? ????????????????????? ?????????? ??????????????? ?? ???????
??????????? ???????? ?????????? ??????? ??????? ?
2. ???????? ????????? ????????????????????? ??????????? ? ?????? ??? ?????
??? ?????????????? ???? ???????????????
3. ???????? ????????? ????????????????????? ??????????? ? ???????? ???
? ?????????????? ???? ?????????? ?????????? ??????? (Null value)
? ??????? (Null Values)
?????? Attribute ???????????????? (Null) ??? ??????????????????????????? ?
???????????? ?????????????????????? ????????????? ??????
??????????????????? ?? ???????????????? ???????????????????? ???????
???????? ????? ??
???????????????
???????????? WHERE <COMPARISION>
Dr. E.F. Codd ???????????????? ????????????????????????????????????????????? ???????????????????????? ??????????
??????????????????? ????????????????????? ???????? ???????????????????????????? ????????????????????????? ???????????????
????????????????????? ??????????????? ??????????????????????????????? ??????????????????????
3.4.1. Restrict
????? Restrict ??????????????????????????????????????????????????????????????????? ? ????????????????????????????? ???????????
???????? ???????????????????????????????????????????????????????? ??
??????
COMPARISION ???????? ????????????????????????????????????????? ????????????????????????? ?????????????????????????????
???????????????????????????????????????? ???? = (???????) < (????????) > (???????) <> (??????????) ??????? ???????????
??????????????????????????????????????? OR (????) AND (???) ??????????????????????????????????
? Union ??? ???????? ?????????????????????? Union
?????? ??????????? ????????????????????? ?????????? ??????
??????? ????? ??????????????????????????????????????????
???????????? ?????????????????? Union ??? ? ????????????????????
????? ?(Compatible Relation) ??????? ??? ?????????????????
???????????????????????????????????????????????????????
????????? (???? ????????) ????????????????? 3.8 ? ????????????
????????? ???????????????????? Union
Union
???? ???? ???????
B001 ??? ??????????
B002 ?? ????????
B003 ????? ???????
B004 ??? ??????????
???????? Union
???? ???? ???????
B001 ??? ??????????
B005 ?? ????????
???? ???? ???????<>/th>
B001 ??? ??????????
B002 ?? ????????
B003 ????? ???????
B004 ??? ??????????
B005 ?? ???????
A B
A UNION B
??????? ????
? ??????????? ????????????????????? ????????????????????
?????????? ??????????? Difference ?????? ????? ????
? ????? ??????? A - ??????? B ? ?????????? ????? ????????????
??? A ????????????????? B ???????? ????????????????????????
??????? B - ??????? A ??????????????????????????????????????
????? ?(Compatible Relation) ????????????????? 3.10 ????
??????????????? Difference ???????????????
Difference
? ?????????????????????? ???????????????? ???????????????
???????????????? ???????? 2 ???????? ???????????? ???????
Attribute ???????????????????? Attribute ??????????
????? Attribute ???????????????????? ????????????
Attribute ??? ??? ????????????????????? ????? Domain ???
? ?????????????
? ???????????? ??????????????????? ???????????????????????
????????????????????????????????????????????????
???????????? ????????????????????????????????????????
??????????????????????? ?????????????????????????
????????????????????????????????????????????????????????
????????????????????????????????????????????????? ??????
Division
? http://203.172.182.81/wbidatabase/unit3/unit3.php
????????????

More Related Content

What's hot (19)

????????? ??????????????????
????????? ??????????????????????????? ??????????????????
????????? ??????????????????
chanoot29
?
????? 3
????? 3????? 3
????? 3
nunzaza
?
it-06-50
it-06-50it-06-50
it-06-50
rilerilept
?
???????????????????????
??????????????????????????????????????????????
???????????????????????
Shengyou Lin
?
????? 6
????? 6????? 6
????? 6
nunzaza
?
???????????????
??????????????????????????????
???????????????
tumetr
?
???????? 3 ?????????????????????????
???????? 3 ????????????????????????????????? 3 ?????????????????????????
???????? 3 ?????????????????????????
Kochakorn Noiket
?
SA Chapter 6
SA Chapter 6SA Chapter 6
SA Chapter 6
Nuth Otanasap
?
???????????????????????????????????
??????????????????????????????????? ???????????????????????????????????
???????????????????????????????????
Watuka Wannarun
?
05 ??????????????????????????????????
05 ??????????????????????????????????05 ??????????????????????????????????
05 ??????????????????????????????????
Nattipong Siangyen
?
????????????? Access ?????????
????????????? Access ?????????????????????? Access ?????????
????????????? Access ?????????
techno UCH
?
Introduction to Database
Introduction to DatabaseIntroduction to Database
Introduction to Database
Opas Kaewtai
?
Introduction to Database
Introduction to DatabaseIntroduction to Database
Introduction to Database
Opas Kaewtai
?
??????#2
??????#2??????#2
??????#2
Worapod Khomkham
?
????? 3 ?????????????????????
????? 3 ?????????????????????????? 3 ?????????????????????
????? 3 ?????????????????????
????? ??????????
?
?????? ????????????????????????????????????????????
?????? ?????????????????????????????????????????????????? ????????????????????????????????????????????
?????? ????????????????????????????????????????????
AmIndy Thirawut
?
????????? ??????????????????
????????? ??????????????????????????? ??????????????????
????????? ??????????????????
chanoot29
?
???????????????????????
??????????????????????????????????????????????
???????????????????????
Shengyou Lin
?
???????????????
??????????????????????????????
???????????????
tumetr
?
???????? 3 ?????????????????????????
???????? 3 ????????????????????????????????? 3 ?????????????????????????
???????? 3 ?????????????????????????
Kochakorn Noiket
?
???????????????????????????????????
??????????????????????????????????? ???????????????????????????????????
???????????????????????????????????
Watuka Wannarun
?
05 ??????????????????????????????????
05 ??????????????????????????????????05 ??????????????????????????????????
05 ??????????????????????????????????
Nattipong Siangyen
?
????????????? Access ?????????
????????????? Access ?????????????????????? Access ?????????
????????????? Access ?????????
techno UCH
?
Introduction to Database
Introduction to DatabaseIntroduction to Database
Introduction to Database
Opas Kaewtai
?
Introduction to Database
Introduction to DatabaseIntroduction to Database
Introduction to Database
Opas Kaewtai
?
????? 3 ?????????????????????
????? 3 ?????????????????????????? 3 ?????????????????????
????? 3 ?????????????????????
????? ??????????
?
?????? ????????????????????????????????????????????
?????? ?????????????????????????????????????????????????? ????????????????????????????????????????????
?????? ????????????????????????????????????????????
AmIndy Thirawut
?

Viewers also liked (13)

Logistics Retail Chains Industrial engineering management e-book
Logistics Retail Chains Industrial engineering management e-bookLogistics Retail Chains Industrial engineering management e-book
Logistics Retail Chains Industrial engineering management e-book
Luis Cabrera
?
Webinar: dotEU - How to Market to Europe better with the European Identity
Webinar: dotEU - How to Market to Europe better with the European IdentityWebinar: dotEU - How to Market to Europe better with the European Identity
Webinar: dotEU - How to Market to Europe better with the European Identity
ResellerClub
?
HOJITA EVANGELIO DOMINGO II CUARESMA B SERIEHOJITA EVANGELIO DOMINGO II CUARESMA B SERIE
HOJITA EVANGELIO DOMINGO II CUARESMA B SERIE
Nelson G¨®mez
?
´³²¹±¹²¹¹«Ë¾¼¶¿ª·¢ÏîĿʵ¼ù
´³²¹±¹²¹¹«Ë¾¼¶¿ª·¢ÏîĿʵ¼ù´³²¹±¹²¹¹«Ë¾¼¶¿ª·¢ÏîĿʵ¼ù
´³²¹±¹²¹¹«Ë¾¼¶¿ª·¢ÏîĿʵ¼ù
yiditushe
?
CV ¦ª. ¦¢¦Á¦Ò¦É¦Ë¦Å¦É?¦Ä¦Ï¦Ô
CV ¦ª. ¦¢¦Á¦Ò¦É¦Ë¦Å¦É?¦Ä¦Ï¦ÔCV ¦ª. ¦¢¦Á¦Ò¦É¦Ë¦Å¦É?¦Ä¦Ï¦Ô
CV ¦ª. ¦¢¦Á¦Ò¦É¦Ë¦Å¦É?¦Ä¦Ï¦Ô
Kalia Vassiliadou-Vathis
?
A ghost in the mirror russian soft power in ukraine
A ghost in the mirror  russian soft power in ukraineA ghost in the mirror  russian soft power in ukraine
A ghost in the mirror russian soft power in ukraine
Pim Piepers
?
WHEN A PSYCHOSIS IS FUNNY ...and when mental illness is stigmatized
WHEN A PSYCHOSIS IS FUNNY  ...and when mental illness is stigmatizedWHEN A PSYCHOSIS IS FUNNY  ...and when mental illness is stigmatized
WHEN A PSYCHOSIS IS FUNNY ...and when mental illness is stigmatized
Ron Price
?
Pendidikan nasional yang bermoral
Pendidikan nasional yang bermoralPendidikan nasional yang bermoral
Pendidikan nasional yang bermoral
ahargun
?
§¶§à§â§Þ§Ú §Ù§Õ?§Û§ã§ß§Ö§ß§ß§ñ §ß§Ñ§â§à§Õ§à§Ó§Ý§Ñ§Õ§Õ§ñ §Ó §µ§Ü§â§Ñ?§ß?
§¶§à§â§Þ§Ú §Ù§Õ?§Û§ã§ß§Ö§ß§ß§ñ §ß§Ñ§â§à§Õ§à§Ó§Ý§Ñ§Õ§Õ§ñ §Ó §µ§Ü§â§Ñ?§ß?§¶§à§â§Þ§Ú §Ù§Õ?§Û§ã§ß§Ö§ß§ß§ñ §ß§Ñ§â§à§Õ§à§Ó§Ý§Ñ§Õ§Õ§ñ §Ó §µ§Ü§â§Ñ?§ß?
§¶§à§â§Þ§Ú §Ù§Õ?§Û§ã§ß§Ö§ß§ß§ñ §ß§Ñ§â§à§Õ§à§Ó§Ý§Ñ§Õ§Õ§ñ §Ó §µ§Ü§â§Ñ?§ß?
Kyiv National Economic University
?
Sydney heli tours aerial filming sydney
Sydney heli tours aerial filming sydneySydney heli tours aerial filming sydney
Sydney heli tours aerial filming sydney
Jordon Verosiki
?
5 Trends in Economic Development You Can't Ignore
5 Trends in Economic Development You Can't Ignore5 Trends in Economic Development You Can't Ignore
5 Trends in Economic Development You Can't Ignore
GIS Planning
?
Membuat kolase album foto
Membuat kolase album fotoMembuat kolase album foto
Membuat kolase album foto
Agung Yuwono
?
Logistics Retail Chains Industrial engineering management e-book
Logistics Retail Chains Industrial engineering management e-bookLogistics Retail Chains Industrial engineering management e-book
Logistics Retail Chains Industrial engineering management e-book
Luis Cabrera
?
Webinar: dotEU - How to Market to Europe better with the European Identity
Webinar: dotEU - How to Market to Europe better with the European IdentityWebinar: dotEU - How to Market to Europe better with the European Identity
Webinar: dotEU - How to Market to Europe better with the European Identity
ResellerClub
?
HOJITA EVANGELIO DOMINGO II CUARESMA B SERIEHOJITA EVANGELIO DOMINGO II CUARESMA B SERIE
HOJITA EVANGELIO DOMINGO II CUARESMA B SERIE
Nelson G¨®mez
?
´³²¹±¹²¹¹«Ë¾¼¶¿ª·¢ÏîĿʵ¼ù
´³²¹±¹²¹¹«Ë¾¼¶¿ª·¢ÏîĿʵ¼ù´³²¹±¹²¹¹«Ë¾¼¶¿ª·¢ÏîĿʵ¼ù
´³²¹±¹²¹¹«Ë¾¼¶¿ª·¢ÏîĿʵ¼ù
yiditushe
?
CV ¦ª. ¦¢¦Á¦Ò¦É¦Ë¦Å¦É?¦Ä¦Ï¦Ô
CV ¦ª. ¦¢¦Á¦Ò¦É¦Ë¦Å¦É?¦Ä¦Ï¦ÔCV ¦ª. ¦¢¦Á¦Ò¦É¦Ë¦Å¦É?¦Ä¦Ï¦Ô
CV ¦ª. ¦¢¦Á¦Ò¦É¦Ë¦Å¦É?¦Ä¦Ï¦Ô
Kalia Vassiliadou-Vathis
?
A ghost in the mirror russian soft power in ukraine
A ghost in the mirror  russian soft power in ukraineA ghost in the mirror  russian soft power in ukraine
A ghost in the mirror russian soft power in ukraine
Pim Piepers
?
WHEN A PSYCHOSIS IS FUNNY ...and when mental illness is stigmatized
WHEN A PSYCHOSIS IS FUNNY  ...and when mental illness is stigmatizedWHEN A PSYCHOSIS IS FUNNY  ...and when mental illness is stigmatized
WHEN A PSYCHOSIS IS FUNNY ...and when mental illness is stigmatized
Ron Price
?
Pendidikan nasional yang bermoral
Pendidikan nasional yang bermoralPendidikan nasional yang bermoral
Pendidikan nasional yang bermoral
ahargun
?
§¶§à§â§Þ§Ú §Ù§Õ?§Û§ã§ß§Ö§ß§ß§ñ §ß§Ñ§â§à§Õ§à§Ó§Ý§Ñ§Õ§Õ§ñ §Ó §µ§Ü§â§Ñ?§ß?
§¶§à§â§Þ§Ú §Ù§Õ?§Û§ã§ß§Ö§ß§ß§ñ §ß§Ñ§â§à§Õ§à§Ó§Ý§Ñ§Õ§Õ§ñ §Ó §µ§Ü§â§Ñ?§ß?§¶§à§â§Þ§Ú §Ù§Õ?§Û§ã§ß§Ö§ß§ß§ñ §ß§Ñ§â§à§Õ§à§Ó§Ý§Ñ§Õ§Õ§ñ §Ó §µ§Ü§â§Ñ?§ß?
§¶§à§â§Þ§Ú §Ù§Õ?§Û§ã§ß§Ö§ß§ß§ñ §ß§Ñ§â§à§Õ§à§Ó§Ý§Ñ§Õ§Õ§ñ §Ó §µ§Ü§â§Ñ?§ß?
Kyiv National Economic University
?
Sydney heli tours aerial filming sydney
Sydney heli tours aerial filming sydneySydney heli tours aerial filming sydney
Sydney heli tours aerial filming sydney
Jordon Verosiki
?
5 Trends in Economic Development You Can't Ignore
5 Trends in Economic Development You Can't Ignore5 Trends in Economic Development You Can't Ignore
5 Trends in Economic Development You Can't Ignore
GIS Planning
?
Membuat kolase album foto
Membuat kolase album fotoMembuat kolase album foto
Membuat kolase album foto
Agung Yuwono
?

Similar to ???????? ????????????????????? ?.2/4 ?????? 1-18-26-29-31-34-40 (20)

Db1
Db1Db1
Db1
Kru Tammada
?
Lesson 1
Lesson 1Lesson 1
Lesson 1
Thanchanok Phongchareon
?
????????????????
????????????????????????????????
????????????????
sa
?
????????????????????????????????????
????????????????????????????????????????????????????????????????????????
????????????????????????????????????
kruthanyaporn
?
??????????????????????????????2
??????????????????????????????2??????????????????????????????2
??????????????????????????????2
sunisa3112
?
?????1???????????????????????????????? ?????????????????????????
?????1???????????????????????????????? ??????????????????????????????1???????????????????????????????? ?????????????????????????
?????1???????????????????????????????? ?????????????????????????
niwat50
?
??????????????
????????????????????????????
??????????????
sariya25
?
Bacic MySql & script Sql for jhcis
Bacic MySql & script Sql for jhcisBacic MySql & script Sql for jhcis
Bacic MySql & script Sql for jhcis
Sakarin Habusaya
?
?????????????????????????????????????????
??????????????????????????????????????????????????????????????????????????????????
?????????????????????????????????????????
chanoot29
?

???????? ????????????????????? ?.2/4 ?????? 1-18-26-29-31-34-40

  • 2. ???????? ????????????????? (Relational Database) ???????? ?????????? ? ????????????????? (Relational Database Model) ??????????? ??????? ?????????????????? Dr. E.F. Codd ????? ????????????????????????? ??????? ????????????????????????????????????????? ???????????????? ?????????????????? ???? ????????????? ???????????????????? ???? ? ??? ??????? ???????? ??????????????????? ????????????????????? ???????? entity ????????????????? ????? ??????????????? ??? attribute ?? ???????????????? ????? ?????????????????????????????????????? entity ???????????????????????? ????????
  • 3. ??? ???????? ?????????????????? (Table) ?????????????????????????????? ????? ?????????????????????? ?????????????????????????????? (Column) ????? ????????????????????????????????? ??????????????????????????????????? ??????????????????????? (Set) ??????? ?????????????????????????????? ???? ????????????????? ?????????? ??????????? ???????? (Relation) ????? (Table) ?????? (Tuple) ??? (Row) ???? ???????? (Record) ???? ??????? ??????????? (Attribute) ??????? (Column) ????????? (Field) ?????????????? (Cardinality) ???????? (Number of rows) ???????????????? (Number of attribute) ???????? (Primary key) ???????????? (Unique identifier) ????? (Domain) ????????????????? ????? (Pool of legal values)
  • 4. ??????????????????????????????? R(???????????????????,????,??????? ,???????) ???????????????????????????????????????????? ????????????? ??? ? ???? ?? ???? ????????? ???????????????? ????????????????????????? ?????????????? ??????? ????????????????????????????????????? ??? ?????????? ???? ???????????????????????? ?????(key) ??????????????????????????????? ? ???????????????????????
  • 5. Dr.E.F.Codd ?? ??????????????????????????????????????? ???????? 3 ?????? ???? 1. ?????????????? ???????????? ??????? ????? 2. ????????????????????????????????? ????? ????? ????? 3. ??????????????????? ????? ??????????????????????????????????? ????????????
  • 6. Relation ?????? ?????????? ????????????????? ?????????????????????? 2 ???? ??????? ??????? ?????? ?????????? ?????????????? ??????? (Relation) ??????? ? ?? Relation ????? ? ????????????????? ? ??????1) ????? Tuples ????? ? ???????????? (No duplicate tuples) 2) ??????????? Tuples ?????????????? 3) ??????????? Attributes ?????????????? 4) ?????? Attribute ??????????????? ? (Atomic) ??????? ??????? ???????? ????????????????????????? ? ????? ??????????????????? ? ???????? ? ???? Relation ??????????????? ?????????????????????? Relation ????????? ?????? Normal form 5) ??????? ???????????? Attribute ?????????????? ??????????? ???????? ?????????????????? (Data Structure)
  • 7. 1) Relation ???? (Base Relation) ???? Relation ????????????????????????? ???????????????? ????????? ?????? ??????? ??? Relation ????? ?Data Definition Language ???? ?? SQL ?????? CREATE TABLE ????????? ??? Relation ???? ????????????????? ???????? ???????????????????? ?? ?????????????? Relation ?????????? ???????????????? ??????????? ? 2) ??? (View) ???????????????????????????? Relation ?????? (Virtual Relation) ???? Relation ???????? ??????????????? ???????? ?? ????????????? ???????? ????????? ????? ???????????? ???????? ?? ?????????????????????????? ?????????????????????????????????? Relation ???? ????????? ???????????? ?? ????? ????????? ??????????????????????? ???? ????????? ????????? Relation ?????????????????????????????????? ? ????????? ? ?????????? ????? ??????? Relations
  • 8. ?????? ???????????? ?????????? Relation ?????????????????????????? Table ???? ????? ??????????????? ????????????????????????? ????? ????? ?????????? ?????????? ?????? (Tuple) ????? ??????????????????? ?? ???????? ??????????? (Attribute) ????????????? 4 ??????????? ??? SID, Sname, GPA, Major ???????????????? ??????? Student(SID,Sname,GPA,Major) ?????????????????????????????????
  • 9. ???????????????????????????? ?????????????????????? ?? ????????????? ???????? ?????????????????????????????????????????? ?????????????? ????? (Domain) ??????????????????? ???????????????? ????? GPA ??????????????? ?????? ??????????? ???????????????????? ??????????????????? 0 - 4 ??????? ???? ??????????????? ??????????????? GPA ?????????? ?? ???????????? ????????
  • 10. ????????????? (Simple key) ??????? key ?????????? ??? attribute ????? ?????????? (Combine key ???? Composite key) ??????? key ??? ??????? ??? attribute ??????? 1 attribute ??????????? (Candidate Key) ???????????????????? ???????????????????? ? ????? ????????????? ? ?????????????? ????????? Student ??? ?????????????????? ??????????? ?????????????? ???????????? ???????? ???????????? ?????????? ??????? ??????????????????????????????????? ???? ????? ????????????? ? ???????? (Primary Key) ???????????????????? ??????????????? ???????? ???????? ???? ??????? ??????? ????? ??????????????????????????? ?????? ????????????????? ??? ????????????????????? ??????????????????????????? ???????????? ?????????????? ????????????????? ????????????????? ????????? ????????????????????????? ???? ?????? ??????? ?????????? ????????????????? ??????????????????????? ??????? (Alternate Key ???? Secondary key) ??????????????????? ???????? ? ???????????? ???? ?????????????? ??????????? ????????????????? ????????? ???? ??????? ??????????????????????? ???????????? Alternate Key ???? (Key)
  • 11. ??????? Student ???????????????? SID ???????????????????? ???? ???????????? ??????????? ?????? ????????????????? ?????????????????????????????????? Major ????????????????????????????????????????? Major ?????????? Major ???? ? ????????????????????????? Major ????????? Student ??? ????????????????? ????? Major ?????????? Major ????????? Major ???????????????????????? Major ???????????? (Super key) ??????? attribute ???? ??????? attribute ??? ??????????????????????? (Tuple) ?????????? ????? ? ???????????? ??? ??? ??????????? ????? super key ????????? attributes ??????? (Foreign Key)
  • 12. ? ??????? ???????????????????? ??????? ????? ??????????? 2 ????? ???????????? ??? ??????????? ??????????????? ????????????????????????????????????????? )3.3.1. ???????????????????????? (Entity Integrity Rule) ???????????????????????? ??????????? ????????????? ?? ???????????????? ?? ???????? ??? ??????????? ???? "????????????????????????????????????????????? ??? ???????????????????????? ?(Null Value)" ?????? ?????????????????????????????? (Identity) ?????????????? ????????????????????? ????????????????????????? ? ? 3.3.2. ?????????????????????????? (Referential Integrity Rule) ???????????????????? ?????? ?????????? ?????????????? ??????? ?????????? ?????????????????????????? ?????? ???????? ???? "?????????????????????? ??? ????? ? ?????????????? ???????????? ????????????????????????? ?????????" ???????????????????????????????? ?? ????????????????? ???????? ???????? ??????? ????????? ??????????????? ?????? ???? ????? ???????????????? ????????? ?????????? ??????????????????????? ????? ????????????????? 3.6 ?????????? ??? ??????? ??????????????? Major ????????????? Major ????????????????????????? ??????? Student ?????? ????????????????? ???????????? ??????????? ???????? ??? ??????????????? ????????????????? ?????????????? 3.3. ?????????????????????????????????????
  • 13. ? 1. ? ?????????? ???? ????????????????????? ?????????? ??????????????? ?? ?????????????????? ???????? ????????? ? ??????? ??????? ? 2. ???????? ???????? ???? ????????????????????? ????????? ?? ??????? ?????????? ???? ????? ????????????? ?????????? ? ??????? ?????????? ?????????????? 3. ???????? ???????? ???? ????????????????????? ????????? ?? ????????? ???? ?????????????? ???? ?????????? ?????????? ??????? ??????????????????
  • 14. ? 1. ? ??????????? ????????????????????? ?????????? ??????????????? ?? ??????? ??????????? ???????? ?????????? ??????? ??????? ? 2. ???????? ????????? ????????????????????? ??????????? ? ?????? ??? ????? ??? ?????????????? ???? ??????????????? 3. ???????? ????????? ????????????????????? ??????????? ? ???????? ??? ? ?????????????? ???? ?????????? ?????????? ??????? (Null value) ? ??????? (Null Values) ?????? Attribute ???????????????? (Null) ??? ??????????????????????????? ? ???????????? ?????????????????????? ????????????? ?????? ??????????????????? ?? ???????????????? ???????????????????? ??????? ???????? ????? ?? ???????????????
  • 15. ???????????? WHERE <COMPARISION> Dr. E.F. Codd ???????????????? ????????????????????????????????????????????? ???????????????????????? ?????????? ??????????????????? ????????????????????? ???????? ???????????????????????????? ????????????????????????? ??????????????? ????????????????????? ??????????????? ??????????????????????????????? ?????????????????????? 3.4.1. Restrict ????? Restrict ??????????????????????????????????????????????????????????????????? ? ????????????????????????????? ??????????? ???????? ???????????????????????????????????????????????????????? ?? ?????? COMPARISION ???????? ????????????????????????????????????????? ????????????????????????? ????????????????????????????? ???????????????????????????????????????? ???? = (???????) < (????????) > (???????) <> (??????????) ??????? ??????????? ??????????????????????????????????????? OR (????) AND (???) ??????????????????????????????????
  • 16. ? Union ??? ???????? ?????????????????????? Union ?????? ??????????? ????????????????????? ?????????? ?????? ??????? ????? ?????????????????????????????????????????? ???????????? ?????????????????? Union ??? ? ???????????????????? ????? ?(Compatible Relation) ??????? ??? ????????????????? ??????????????????????????????????????????????????????? ????????? (???? ????????) ????????????????? 3.8 ? ???????????? ????????? ???????????????????? Union Union
  • 17. ???? ???? ??????? B001 ??? ?????????? B002 ?? ???????? B003 ????? ??????? B004 ??? ?????????? ???????? Union ???? ???? ??????? B001 ??? ?????????? B005 ?? ???????? ???? ???? ???????<>/th> B001 ??? ?????????? B002 ?? ???????? B003 ????? ??????? B004 ??? ?????????? B005 ?? ??????? A B A UNION B ??????? ????
  • 18. ? ??????????? ????????????????????? ???????????????????? ?????????? ??????????? Difference ?????? ????? ???? ? ????? ??????? A - ??????? B ? ?????????? ????? ???????????? ??? A ????????????????? B ???????? ???????????????????????? ??????? B - ??????? A ?????????????????????????????????????? ????? ?(Compatible Relation) ????????????????? 3.10 ???? ??????????????? Difference ??????????????? Difference
  • 19. ? ?????????????????????? ???????????????? ??????????????? ???????????????? ???????? 2 ???????? ???????????? ??????? Attribute ???????????????????? Attribute ?????????? ????? Attribute ???????????????????? ???????????? Attribute ??? ??? ????????????????????? ????? Domain ??? ? ?????????????
  • 20. ? ???????????? ??????????????????? ??????????????????????? ???????????????????????????????????????????????? ???????????? ???????????????????????????????????????? ??????????????????????? ????????????????????????? ???????????????????????????????????????????????????????? ????????????????????????????????????????????????? ?????? Division