Sie sind auf Seite 1von 19

DATABASE MANAGEMENT

S y s t e m

Access 2003 1
 Relationships Tables

1- Basic Relationships

Basic Relationship EckecjCabIRbePTdUcxageRkam³


One-to-one TMnak;TMngBImYyeTAmYy
( )

One-to-many ( TMnak;TMngBImYyeTAeRcIn )

Many-to-many TMnak;TMngBIeRcIneTAeRcIn
( )

Prepared by Sann Sothearath Access 2003 2


 One-to-one Relationship: mann½yfa ral;
Record EdlmanenAkñúg Table mYyGacmanTMnak;TMng

CamYynwg Record EdlmanenAkñúg Table epSgeTot)anEt


mYyKt;. elakGñkEtCYbTMnak;TMngTinñn½y One to One
Relationship eTAtamkardak;kMhitNamYy dUcCabuKÁilmñak;

RtUvmanRbBnRsbc,ab;Etmñak;Kt;.
Prepared by Sann Sothearath Access 2003 3
 One-to-many Relationship: enAeBlEdlTMnak;TMng
(Relationship) RtYv)anbegáItrvag Tables BIr Tables TaMgBIrRtUvEtman

Foreign key edIm,IeGayvaGacTak;TgKñaenAkñúg Database mYy. RbsinebI

Foreign key enAminTan;rkeXIjenAeLIyenaH Column d¾smrmümYy

EdlCa Primary key én Table NamYyRtYveRCIserIsnigbEnßmelI Table


epSgeTotedIm,IeFIVCa Foreign key enAelI Table enaH. enAeBl one-to-
many Relationship RtUv)anbegáIteLIgrvag Tables BIr®tUvRCIserIs

Primary key xag ' one’ ' Table Ca Foreign key edIm,IbEnßmxag ' many '

Table.
Prepared by Sann Sothearath Access 2003 4
Prepared by Sann Sothearath Access 2003
 Many-to-many Relationship: kñúgTMnak;TMngBIeRcIneTA
eRcInenHminGacekIteLIgedaypÞal;rvag Entities BIr)aneT luHRtaEtman
Table mYyeTot®tUv)anbegáIteLIgedIm,IeGaymanTMnak;TMngeTA Tables

TaMgBIrehIyyk Primary key rbs; Tables TaMgBIr mkrYmKñaeFIVCa Primary


key rbs;xøÜn. kñúgTMnak;TMngBIeRcIneTAeRcInenaH Table min
RtUv)aneKbBa©ÚlKñaeT eRBaHebIeyIgbBa©ÚlKñaenaHvaminRtwmEtekItmannUv
Tinñn½ydEdl²Can;Kña (Redundant data) enaHeTvaEfmTaMgeFVIeGayman
karBi)akRKb;RKgB½t’mannImYy² enAkñúg Table enaHpg.
Prepared by Sann Sothearath Access 2003 6
Prepared by Sann Sothearath Access 2003 7
Primary Keys and Foreign Keys

Primary keys: Primary key Ca column mYyrWRkum


énColumns EdlkMnt;eGay Record nImYy²man
lkçN³xusKña.
Foreign keys: Ca Columns Edlpþl;nUv Relationship

eTAnwg Primary key rvag Entities epSg².


Prepared by Sann Sothearath Access 2003 8
2- Create Relationships: munnwgbegáIt Relationships
eyIgRtUvbiT Object EdlkMBugGnuvtþn_eGayGs;TukEt Database
Windows bnÞab;GñkGac

- cucelI Tool menu


- cucelI Relationships...
- cucelI Relationships menu
- cucelI Show Table
Prepared by Sann Sothearath Access 2003 9
Prepared by Sann Sothearath Access 2003 10
c,ab;TaMg3 én Relationship

Prepared by Sann Sothearath Access 2003 11


 Enforce Referential Integrity: ral;karbBa©Úl Data enAkñúg Sub
Table RtUveFVIkareKarBeTAnwg Data Edlmankñúg Main Table.
vamantYnaTIsMrab;bgðajnUvtMél Relationship
 Cascade Update Related Fields: ral;karEkERb Data enAkñúg
Fields Primary Key RtUv)aneFVIkarEkERbeTAnwg Field Foreign Key
enAkñúg Sub Table.
 Cascade Delete Related Records: ral;karlub Data enAkñúg

Main Table RtUv)aneFIVkarlubral; Sub Table EdlmanTMnak;


TMngKña.
Prepared by Sann Sothearath Access 2003 12
 c,ab;TaMgbIén Join Type:

Prepared by Sann Sothearath Access 2003 13


 1: For Example of Inner Join
Student :Table Study: Table
StudentID Name StudentID Subject
001 A 001 DB
002 B 002 Access
003 C Word

Student Study: Select Query


StudentID Name Subject
001 A DB
002 B Access

Prepared by Sann Sothearath Access 2003


 2: For Example of Outer Join Left
Student :Table (Left) Study: Table (Right)
StudentID Name StudentID Subject
001 A 001 DB
002 B 002 Access
003 C Word

Student Study: Select Query


StudentID Name Subject
001 A DB
002 B Access
003 C

Prepared by Sann Sothearath Access 2003


 3: For Example of Outer Join Right
Student :Table (Left) Study: Table (Right)
StudentID Name StudentID Subject
001 A 001 DB
002 B 002 Access
003 C Word

Student Study: Select Query


StudentID Name Subject
001 A DB
002 B Access
Word

Prepared by Sann Sothearath Access 2003


- cucelI Create Button vanwgbgðajBIkarP¢ab; Relationship

Prepared by Sann Sothearath Access 2003 17


cMNaM³ lkçx½NÐénkarP¢ab; Relationship RtUvcaM)ac;man³
- TableTaMgBIrEdleyIgcg;P¢ab;RtUvman Field Name, Data
Type, Field Properties dUcKña

- Table TaMgBIrebImanTinñn½yRtUvmanTaMgBIrehIyebIsinCa

Gt;RtUvGt;TaMgBIr
-RtUvkMNt; Primary Key enAelI Table EdlCaeKal b¤ em
Prepared by Sann Sothearath Access 2003 18
 karP¢ab; Relationship KWeKeFIVedIm,IeGay Tables
manTMnak;TMngKña ehIyKYrcgcaMEdrral; karbegáIt
Tables mincaM)ac;RtUvP¢ab; Relationship ral;elIk

enaHeT. eKP¢ab;enAeBlEdl TableBIrb¤eRcInEdlman


TMnak;TMngKña .
Prepared by Sann Sothearath Access 2003 19

Das könnte Ihnen auch gefallen