In this tutorial we will create three extra database tables - Result, Assessment and Tutor
Remember that the datatypes and field sizes need to be consistent across linked fields in different tables throughout your database. ie if tutor_no is a numeric field in Tutorial table then it should also be numeric in the Tutor table.
| Field Name | Data Type | Field Properties |
|---|---|---|
|
tutor_no (Primary Key) |
Number |
Field size:Integer Required: Yes Indexed: Yes[No Duplicates] |
| t_name | text |
Field size: 20 Input Mask: >CCCCCCCCCCCCCCCCCCCC Required: yes Allow Zero Length: No Indexed: Yes[Duplicated OK] |
| t_office | text |
Field size: 4 Input Mask: >?999 Allowed Zero Length: No Indexed: No |
| tutor_no | t_name | t_office |
|---|---|---|
| 1 | MR TOM BURNS | C345 |
| 2 | MS JOAN RIVERS | F780 |
| 3 | DR RIVIERA | C112 |
| 4 | PROF SIMPSON | C768 |
| Field Name | Data Type | Field Properties |
|---|---|---|
|
assess_no (Primary key) |
number |
Field size: Integer Required: yes Indexed: Yes[No duplicates (specify as the key value) |
| a_desc | text |
Field size: 25 Input Mask: >CCCCCCCCCCCCCCCCCCCCCCCCC Required: Yes Alow Zero Length: No Indexed: No |
| max_mark | Number |
Field size:Integer Required: No Indexed: No |
| weight | Number |
Field size: Integer Required: No Indexed: No |
| assess_no | a_desc | max_mark | weight |
|---|---|---|---|
| 1 | Assignment 1 (theory) | 50 | 10 |
| 2 | Assignment 2 (prac) | 30 | 20 |
| 3 | Presentation | 10 | 10 |
| 4 | Exam | 100 | 60 |
| Field Name | Data Type | Field Properties |
|---|---|---|
|
stud_id (Primary key) |
text |
Field size:6 Input Mask: 999999 Required: Yes Allow Zero Length: No Indexed: Yes[Duplicates OK] (specify as part of the key - see below) |
|
assess_no (Primary key) |
Number |
Field size: Integer Required: Yes Indexed: Yes[Duplicates OK] (specify as part of the key -see below) |
| mark | Number |
Field size: Integer Required: Yes Indexed: No |
Before entering sample data into the Result table we will update the table relationships.
From the Database Window select Relationships... from the Tools menu (or click the Relationships button in the Toolbar).
Add the new tables to the relationship layout using the Relationships → Show Table option.
Establish the following relationships (enforce Referential Integrity, Cascading Update and Cascading Delete in all cases).
The relationship layout should resemble something like:
Now enter the following sample data in the Result table
Note:
| stud_id | assess_no | mark |
|---|---|---|
| 900543 | 1 | 45 |
| 900543 | 2 | 20 |
| 898265 | 2 | 15 |
| 898265 | 1 | 40 |
| 904372 | 1 | 35 |
| 904372 | 2 | 22 |
| 902514 | 1 | 36 |
| 902514 | 2 | 28 |
| 895601 | 2 | 25 |
| 895601 | 1 | 33 |
| 909533 | 2 | 19 |
Can you create the following queries? Think about what the answers should be and compare your output to what you expect. Write down a diagram of the query solution.