Lesson 8 - Data Dictionary - ERD Attributes

Remember an Entity is a real-world thing (customer, products, books) that need to represented in a system. Entities have attributes which are elements that define a particular entity.

The top or first level ERD identifies the entities and their relationships, it is a useful tool in describing the application domain and is used as a base document to determine further detail.

The next step is to identify the attributes of those entities, this may be done in conjunction with the User Requirement Specification (URS), if one exists, and/or by structured interviews with the project sponsors and users.

Several methods exist for showing attributes on an ERD - we will use a table form (similar to Access) relationships view.

ERD1

One or more of the attributes of an entity is defined as the PRIMARY KEY. To guarantee uniqueness numbers are normally used for primary key attributes. Therefore in the example above the primary key for the STUDENT entity would be IDNumber.

 


 

Exercise 9 - Using the ERD below for the Rapid Results system, work out the attibutes required on each entity.

ERD2


 

How do we know that a lesson is for a pupil? One of the attributes of the entity 'Pupil' will be the 'Pupil number'. This unique number identifies the 'Pupil' and is the primary key of the entity. When a lesson is booked for that pupil an occurrence of the 'lesson' entity is created. So that it is possible to tell which Pupil is having the lesson the 'Pupil number' is inserted into the occurrence of the 'lesson' entity. This is known as a FOREIGN Key.

When the attributes have been identified the information about each Entity and its attibutes need to be documented in a DATA DICTIONARY. You create a table for each entity and then list each attribute. Each attribute must have a unique name. The relationship, desciption and purpose of each attribute must be explained. If the attribute is a Primary or Foreign key this should be identified in Key Type. You need to work out the length of data required in each field and also the format of the data.

 

Data Dictionary Example - A DVD Shop

ERD3

 

DVD

Element ID

Entity-Relationship

Description

Purpose

Key Type

Length

Format

DVD_No

DVD, Rental

DVD ID number

Provides a unique number for each DVD

Primary

6

Numeric

DVD_Name

DVD

DVD Name

Title for each DVD

 

25

Text

DVD_Rating

DVD

DVD Rating

Rating for each DVD

 

2

Text

DVD_Rental_Price

DVD

DVD Rental Price

The rental price for each DVD

 

 

Currency

CUSTOMER

Element ID

Entity-Relationship

Description

Purpose

Key Type

Length

Format

Cust_ID

Customer ,  Rental

Customer ID number

Provides a unique number for each customer

Primary

6

Numeric

Cust_Surname

Customer

Customer surname

Surname of customer

 

30

Text

Cust_First

Customer

Customer firstname

Firstname of customer

 

15

Text

Cust_Title

Customer

Customer title

Title of customer

 

10

Text

Cust_House

Customer

Customer House name/no

House name/no of customer

 

15

Text

Cust_Street

Customer

Customer street

Street of customer

 

30

Text

Cust_Town

Customer

Customer town

Town of customer

 

30

Text

Cust_PostCode

Customer

Customer postcode

Postcode of customer

 

8

Text

Cust_Tel

Customer

Customer Telephone

Telephone number of customer

 

12

Text

 

RENTAL

Element ID

Entity-Relationship

Description

Purpose

Key Type

Length

Format

DVD_No

DVD,  Rental

DVD ID number

(Foreign key) unique number for each DVD

Foreign

6

Numeric

Rental_No

Rental

Rental Number

Provides a unique number for each rental occurrence

Primary

6

Numeric

Cust_No

Customer, Rental

Customer ID number

(Foreign Key) unique number for each customer

Foreign

6

Numeric

Rental_Date

Rental

Rental date

Rental date of the DVD

 

 

Date


 

Exercise 10 - Using the attributes you identified in exercise 9 create a Data Dictionary for the Rapid Results ERD.