Logical Data Modelling

 

Logical data modelling is the top-down design method often used in developing a database application. This approach has three stages:

 

•  Identify the entities that make up the system

•  Analyse the data to associate the data used by an organisation with particular entities.

•  Identify the relationships between entities

 

The systems analyst develops an entity-relationship model (ERM), which is shown graphically as an entity-relationship diagram (ERD).

 

EXAMPLE (examples of ERD's written by Phil James)

 

Entity diagram for college library borrowing system

 

 

Cardinality and Optionality

(Explanations written by Phil James)

Note: Each of these is considered from the direction of A to B.

 

Cardinality

One to One

One to Many

Many to One

Many to Many

Optionality

Mandatory-to-Mandatory

Mandatory to Optional

Optional to Mandatory

Optional to Optional

Reading Entity relational diagrams

Looking at a complete ERD can sometimes make it hard to establish the relationship (association between) the entities. So it becomes necessary to break it down.

(Written by Phil James)

 

 

Looking at it from Entity A's perspective: A has a mandatory (must be) relationship with B; A has a one-to-many relationship with B.

 

Looking at it from Entity B's perspective: B has an optional (may be) relationship with A; B has a one-to-one relationship with A (no crow's foot at the other end).

 



Remember: The first step in designing an ER diagram is a proper understanding of the problem, which needs to be turned into an ER diagram - without this you cannot tackle the problem correctly. To develop the ER diagram you will need enterprise rules. These are rules about the enterprise (real world business) on which your database is going to be modelled. The enterprise rules for the above diagram are: that A must employ one or more B's but that each B may be employed by one A.

 

Activity

 

Entity Relationship Questions

(Questions written by Phil James)

1. What word describes the relationship that exists between two (or more) entities such as one-to-one, one-to-many, many-to-one, many-to-many?

 

2. What word describes the nature of the relationship i.e. whether it is optional or mandatory?

 

 

3. Look at the diagram below then answer the following questions:



4. Which one of the following does the boxes in the diagram represent?

5. Which one of the following does the lines in the diagram represent?

6. What is the nature of the relationship between D and C?

7. What is the nature of the relationship between A and D?

8. What is the nature of the relationship between B and C?

9. What is the nature of the relationship between A and B?

10. What type of relationship exists between A and B?

11. What type of relationship exists between A and D?

12. What do A, B, C and D represent in the diagram?

13. Which of the following relationships are not acceptable in completed ER Diagrams?

14. A college has five teachers. Each teacher takes about three classes a day. What is the relationship between teachers and their classes?

15. There are many students in each class and students have several classes a day. What is the relationship between students and classes?

16. The college keeps a personal record of each student in the college. Which one of the following describes the relationship between each college personal record and its students?

17. Below is a table, which represents an Entity and its occurrences. Look at it closely then answer the following questions:

CUSTOMER

Customer_No

Surname 

First_Name

Telephone_No

0123

Grove 

Olive 

01783 023999

0125 

Jenkins

Phyllis

01785 233242

0130

Jelly

Kelly

01270 345566

0234

Sumner

Gerald

01260 232322

18. What is signified by the column marked Surname?

19. What does the box containing 0125 represent on the second row of the table?

20. What does the underline on Customer_No represent?

21. What type of fields/attributes would we apply an index to in the table?

 

Activity

In groups produce an entity relationship diagram on paper. You will be given one of the scenarios below:

•  An appointments database for a doctor's surgery

•  A stock control database including the sale of goods for a computer company

•  A lesson-booking database for a driving school

•  A sports club membership database

•  A college admissions database