Relation Ship ��� ������ҧ��������ѹ�������ҧ
Table (����ͧ�¡�͡�������� � Table ������Ŵ������ӫ��ͧ������,
�����Ѵ��鹷��Ѵ��, �дǡ㹡������¹�ŧ���)
㹡�÷� Relation Ship ��� ��ͧ��˹�����Ŵ����������§�ѹ��ͧ��
DataType, FieldSize
�����ѹ�ء��С��
��С�˹�����Ŵ��������ѹ(�����ѡ)�� PK �֧������ö������§�ѹ��
|
| ��÷� Relation Ship �բ�鹵�ѧ��� |
���˹�ҵ�ҧ Database
1. R-Click ����鹷����ҧ ���͡ Relation Ship �������͡�ҡ
tools bar ����
2. �� Show ��ª��� Table ����� ���͡ Table ����ͧ���������§
(�ҡ���͡�Թ�� ����ԡ��� Table ����Թ���ǡ����� Delete
, ����ҡ���͡�Ҵ仵�ͧ��������� R-Click ���͡ Show
Table ���ʴ���ª��� Table ��) 㹷�������͡ Customer
��� Table Order_list
3. ��ԡ���͡ Field Name ����ͧ���������§ �ҡ任���º�
FieldName ����ͧ��è�������§�ѹ�ͧ�ա Table ˹��
(㹷�������ҡ��Ŵ� CustomerID �� Table Customer ���ҧ�����Ϳ�Ŵ�
CustomerID �� Table Order_list) �Т��˹�ҵ�ҧ Edit
Relation ����Ǩ�礴٪��� Table ��� FieldName ��Ҷ١������� |
|
|
Enforce Referential Integrity
- �ѧ�Ѻ���ء� Foreign Key ��ͧ�� Primary
Key ������
- �������� Primary Key ���������ö���
Foreign Key ����� |
Cascade Update ( ��Ѻ��ا����¹ )
- ����ա������¹�ŧ Primary
Key �ͧ Record ˹��� �зӡ������¹�ŧ���
Foreign Key �������ѵ��ѵ�
Cascade Delete ( ź����¹ )
- ����ա��ź��� Primary Key
�зӡ��ź Record ����� Primary
Key ��� �� Foreign Key
���� �͡仴���
|
����й�㹡�����ҧ Relation
Ship
��÷ӡ���������
����������������
��ͧ�繡������������ҧ
Primary Key �Ѻ Foreign Key ����(��ҹ˹�觵�ͧ��
Primary Key)
��ͧ�����ҷء�
��ҷ����㹵��ҧ�������� Primary Key
�դ��㹵��ҧ����� Primary Key
���� |