Lecture 2 - Entity Relationship Diagram PDF

Title Lecture 2 - Entity Relationship Diagram
Course Database Management and Programming
Institution De Montfort University
Pages 4
File Size 58.5 KB
File Type PDF
Total Views 134

Summary

Entity Relationship Diagram...


Description

Entity Relationship Diagram The Use of Conceptual Models

Step 1 is taking notes of client’s issues or problems. Translation of real-life problems into information that is applicable to computer science (e.g. translating client’s needs and problems, so we can create a database, so spotting the entity, attributes and keys).

-

An entity is a real-life object, such as a car or student, which is represented as a rectangle. A weak entity is not uniquely identifiable, and relies on another entity to be existent.

-

An associative entity is representing an extra entity that is the relationship of between the two entities.

-

All the circles (attributes) are the columns of the table, and the square (entity) is the name of table.

-

To represent the key, you underline the name of the attribute.

-

A weak entity has a partial primary key, because it needs another key from the other entity (table) in the strong entity to form an identifiable entity. For example, in a university, you have employees and lecturers. A lecturer can have dependence, such as a family. In the database, the university will create dependence for the lecturer, if they exist. However, those entities that are dependent on the lecturer are weak entities. This is because; they would never exist on the database, if the lecturer did not exist. You would not have a primary key for them; you would have a combination of the lecturers’ primary key that helps identify them with that entity. A multivalued attribute is an attribute that has more than one value.

-

-

-

-

As we can see below, hobby (an attribute) has been represented as a multivalued attribute. This is because; the entity (the user) can have multiple hobbies, which means you can have multiple values for the attribute “hobby”. Derived attribute means that you can calculate an attribute’s value using another attribute. In other words, its value “derives” from another attribute.

An example of a derived attribute is “price including VAT”. Using the attribute “price excluding VAT” and “VAT rate,” we can automatically assign a value to the attribute “price including VAT,” without the user having to manually enter the information.

-

an example of composite attribute where we have the composite attribute “address,” connected to the entity “student,” that has been divided into other independent attributes, such as country, state and city. All of these are subdivided from address, and represent aspects of the address that, when put together, create the whole picture.

Types of Relationships -

To represent a relationship, you put it in a diamond. A strong relationship can exist anywhere; it can always exist. For instance, the entity “courses” can exist without the entity “students,” as the courses is integrated with the university. Therefore, the relationship of the entity is independent, as it does not rely on another entity to be existent. The primary key of the course entity, such as course code, is not referenced from another entity and only derives from its own entity, making the relationship strong and independent.

-

A weak relationship is opposite to a strong relationship. For example, for a student to be a part of a university, they must be enrolled into a course. Therefore, the entity “student” is dependent of the entity “course,” so that they can exist on the database. The primary key of the entity student (the child), such as course code, would have to contain the primary key of the entity course (the parent). Alternatively, you can use a solid line (strong relationship) and dotted line (weak relationship).

-

One-to-One (1:1) The information regarding the type of relationship is given by the client.

-

Total participation: all entities (relationship)… Partial participation: not all entities (relationship)…

-

You can have books without chapters, but you cannot have a chapter without a book. Not all books contain chapters (1). All chapters contain a book (2). It is a weak relationship, as the existence of a chapter relies on the existence of the book.

Diagrammatic technique for displaying ER Models -

Everything from the Chen model can represented like a class model:

Bakers Notation -

Fork: Many. Single line: One. Circle: Zero.

-

Inclusive association example: a lecturer (a) can be a supervisor (b) and a personal tutor (c). Exclusive association example: a lecturer (a) can only be either a supervisor (b) or a personal tutor (c).

Creation process of an ER diagram -

Information that would be obtained from the client for the creation of a database.

Step 1 -

You start by finding the entities (i.e. departments, modules, students and lecturer). University is not an entity, as it is the entire database.

Step 2 -

Next, you find the relationships, so can find the connection between entities.

Step 3

-

Insert the entities, depicted by a rectangle, anywhere on the page.

Step 4 -

Insert the relationships, depicted by a diamond, between entities. Using the scenario, we know there is a relationship between department and course, as “each department offers several courses.”...


Similar Free PDFs