Databases Worksheet 1 Entity Relationship Mod
Databases Worksheet 1 Entity Relationship Mod
2. The relationship between two entities may be one of three types, or degrees.
What are the three degrees of relationship between entities?
3. Draw entity relationship diagrams for each of the following pairs of related entities:
(a) Dentist and patient
1
Worksheet 1 Entity relationship modelling
Unit 11 Databases and software development
4. A company makes a range of kitchen utensils which they sell online. They record details of
their customers, products and orders received in a database. An order may be for several
products.
Complete the E-R diagram to show all the relationships between all the entities.
Customer Product
Order OrderLine
5. Complete the design of the order form shown below. Enter some data for a sample order
for three different products.
Order number:
Date:
Total:
On your order form, what are the primary key fields of the entities Customer, Product, Order,
OrderLine?
2
Worksheet 1 Entity relationship modelling
Unit 11 Databases and software development
Task 2
This is a practical exercise using MS Access. You are going to be working with the database
RevisionSubs_stage1.accdb. This consists of three tables called tblCustomer, tblProduct,
tblSubscription.
11. A “Show table” window opens. Click each table in turn and click Add. Close the window and
you will see the three tables displayed. Click and drag to put tblSubscription in the middle.
3
Worksheet 1 Entity relationship modelling
Unit 11 Databases and software development
12. To create a relationship, you drag the primary key field from the “one” side to the
corresponding field in the “many side of the related table. Drag CustID from tblCustomer
table to custID in tblSubscription.
13. A window appears. Click the box next to Enforce referential Integrity. This will ensure that
you cannot create a record in tblSubscription for a customer who does not exist in
tblCustomer. Now click Create.
If there is already data in tblSubscription which refers to a non-existent customer, you will
see this message:
If you get this message, you need to take another look at the records in tblCustomer and
tblSubscription and make sure you have all the necessary records on tblCustomer.
14. Create the relationship between tblProduct and tblSubscription. Remember to enforce
referential integrity.
Now the relationships will be shown: