Presentation is loading. Please wait.

Presentation is loading. Please wait.

Tutorial 2 Data Modelling. 3 Terminology & Notation(1) An entity is an object about which the system needs to hold information –Customer, Student, Course.

Similar presentations


Presentation on theme: "Tutorial 2 Data Modelling. 3 Terminology & Notation(1) An entity is an object about which the system needs to hold information –Customer, Student, Course."— Presentation transcript:

1 Tutorial 2 Data Modelling

2 3 Terminology & Notation(1) An entity is an object about which the system needs to hold information –Customer, Student, Course –often represent things in real world An occurrence of an entity describes, for example, one particular customer or product The attributes of an entity are the data items that make up the entity –StudentName, StudentAddress, –only record attributes that are of significance to the system

3 Terminology & Notation(2) The value of an attribute is the value of that attribute for a particular entity occurrence –John Browne is value of StudentName attribute. A key to an entity is an attribute or set of attributes that uniquely identify each occurrence of the entity. –the attribute StudentNo is key to entity Student as Name will not necessarily uniquely identify a student.

4 Exercise Read the Football Competition Case Study given to you. Name the entities about which you think the council needs to keep data. Which of these things are entities? Attributes? Values?

5 Terminology & Notation(3) Candidate keys are any possible keys for a entity –the attributes Name and DateOfBirth is a candidate key for the entity Student. A primary key is the candidate key that is decided to be used as the key. Primary keys should have the following properties –must be uniques for each occurrence of an entity –must always have a value –e.g. students are always assigned a number as soon as they register –should not contain an attribute that is likely to change –e.g. using name or telephone number

6 Terminology & Notation(4) A foreign key is an attribute in a entity which is a primary key in another entity –e.g. Student and Course entities Foreign keys act as links or navigational routes between entities –e.g. who is the course director for student A

7 Exercise Look at the entities you have chosen in the Football competition. Can you see any primary keys? Can you see any foreign keys?

8 Relationships A relationship is a link between two entities which is significant for the system –e.g. Customer ‘places’ an Order –relationships trace the access from one entity to another e.g. find the orders placed by a customer –Relationships are implemented using foreign keys

9 5 Relationships Relationships are named by giving them a label –there are two relationships in each link –e.g. Course “is attended by” Students Student “registers for” a Course

10 Relationship cardinality/degree describes the type of relationship – I.e. how many of each entity is involved in the relationship –One to one –One to many –N to many –Many to many –Reflexive

11 one-to-one relationship any occurrence of the first entity is related to one and only one occurrence of the second entity –e.g. Husband and Wife one to many relationship - any occurrence of the first entity is related to one or more occurrences of the second entity –e.g. Doctor and Patient Course and Student

12 many to many relationship - two entities are related to each other by many to many relationships –e.g. Musician and Concert Course and Lecturer –N to many relationship –E.g. game and team, match and player

13 reflexive relationship - an occurrence of an entity is related to other occurrences of the same entity –e.g. “manages” relationship “part” relationship

14 6 A relationship between two entities is optional if an occurrence of the first entity can exist without being associated with an occurrence of the second entity –e.g. Course and Student A relationship is mandatory if every occurrence of the first entity must participate in a relationship with an occurrence of the second entity –e.g. Student and Course Optionality

15 7 Characteristics of a good data model –Data items should be grouped in logical groups e.g customer’s name, address, phone, etc.. –Each entity should have a unique primary key –There should be no redundant data data items that are never used by the system same data items in different entities data in one place can be derived from data held elsewhere Two ways of getting there - E-R modelling and normalisation Data Modelling - continued


Download ppt "Tutorial 2 Data Modelling. 3 Terminology & Notation(1) An entity is an object about which the system needs to hold information –Customer, Student, Course."

Similar presentations


Ads by Google