Professional Documents
Culture Documents
Relationship Notes
Relationship Notes
Relationship Notes
❖ Both tables are needed to create relationship and same fields are in the
both tables.
Primary Key
Foreign Key
It is a field that is related to the primary key of primary table in relationship.
Primary Table (Parent table)
The table contain primary key it call as a primary table.
Related table (Child table)
The related contain foreign key it call as a related table.
❖ The data type of both primary key and foreign key must be same.
Relationship types
Relationship type depends on how to relate columns are defined. There are 3
types.
1. One to One
2. One to Many
3. Many to Many
Foreign key field in student table has matching records in course table. In this type primary key
and foreign key have primary key.
Co_No Co_No
001 001
002 002
Related Table
In this type of relationship primary key field in course table can have many matching records in
foreign key table in student table. But a data in student table can have one matching record in
course table.
In this type primary table Have primary table have primary key and there is no primary key for
the foreign key in related table.
Co_No Co_No
001 001
002 001
001
002
Primary Table
002
Related Table
In this type a data in course table have many matching records in students table and a data in student table can
have many matching records.
In this type of relationship both primary key and foreign key are not in primary and related table.
Order_ID Order_ID
001 001
001 001
001
Relationship Settings
Edit Relationship – enforce referential Integrity
1. You can’t enter a value for the foreign key field in the related table that does not existing in the
primary key of primary table.
2. But you can enter a null value for the foreign key field.
3. So when entering data first you enter data for primary table. Then enter data for the related
table.
4. You can’t delete record from primary table, if matching record in related table.
5. You can’t change the record from primary table that matching record existing in related table.
FORM
The form is a graphical interface, use to add data or view data or modify data,
The form views the data of one record in table at once.
Query criteria
1. Text criteria
a. Matching Text
Field Status
Table Employee
Criteria “Doctor”
b. Use OR
Field Status
Table Employee
Criteria “Doctor”
OR “Teacher”
c. Use ‘Not’
Field Status
Table Employee
Criteria Not “Teacher”
d. Not in
e. Like
Field Emplooye_Name
Criteria Like “P”
Field Payment
Table Student Details
Criteria >=13000
b. Use Between
c. OR
3. Date Filter
a. Use #Date#
Field DOB
Table Student
Criteria # 04 / 04 / 2007 #
b. Use ‘Date’
Criteria = Date ()
Field Emp_Name
Table Details
Criteria Is null