You are on page 1of 5

CS331 Database Management Systems

Lab

1. Overview
• Database is the collection of information well organized so that data can be easily stored,
managed, updated, and retrieved.
• An Entity–relationship model (ER model) describes the structure of a database with the
help of a diagram, which is known as Entity Relationship Diagram (ER Diagram). An
ER model is a design or blueprint of a database that can later be implemented as a
database.
• ER diagram has three main components: Entity, Attribute, and Relationship.
• An entity is an object or component of data (tangible/ non-tangible)

• An attribute describes the property of an entity.


• A relationship shows the relationship among entities. There are six types of relationships:

2. ER Diagrams with Draw io


Draw io is a free online/offline diagram software for making flowcharts, process diagrams,
org charts, UML, ER and network diagrams. Draw io provides us with an online/offline ER
Diagram tool to design our ERM.

• Once you install the software on your machine; create a new diagram:
• Name your diagram file, select: Entity Relationship Diagram and click on “create”:

• Your workspace is now ready, all you need to do is click on “Entity Relation” on the
bottom-left side of your window:
3. Exercise 1:

Now let’s design our first Entity Relationship Diagram!


We want to organize, store and manage the data of our Students who are enrolled in
Associations. Throughout the year, our active students organize Events!

• One student may be enrolled in different associations at the same time. And might NOT be
enrolled at all!
• In one association, we have AT LEAST ONE student enrolled (the president!)

• Our enrolled students organize events.


• One enrolled student within the association, might organize many events. He/she might not
organize any events at all!
• An event to take place, must be organized by at least one enrolled student!

• An event to take place, must be hosted by at least one association.


• One association must at least host one event for it to be sustained for the next years.

➔First, define your entities along with their corresponding attributes.

➔Next, define the relationships between your entities. Finally, define the cardinalities.

4. Exercise 2:
Transform the following verbal descriptions into their corresponding ER Diagrams:

a) Customer_Management

• In a shop, customers get discounts on items. Each item can only have one discount rate.
• Each item must belong to a category. Within one category, we find many items!
• The Customer has a unique id (CustomerId), a year of birth (YearBirth) and a Nationality.
• The item must have a unique id (ItemId) and a Price.
• The category has a CategoryId and a Name.

b) Company_Management
• A person is either an employee or a manager.
• A person works for one or more companies.
• Companies usually employ at least one person.
• A manager manages one department, which is assigned to one company, while companies have
several departments.
• A person is characterized by an Id, a name, an age, and a nationality.
• A manager, in addition, has number of years of service (YearsService).
• The department has a name and a description. And so does the company.
c) Flights_Management

• An airplane is assigned to several flights.


• One flight is assigned to an only one airplane.
• One flight is uniquely identified by its flight id along with the airplane id.

• A pilot can perform several flights.


• A flight is performed by several (normally at least two) pilots.

• The pilot is characterized by a SecurityID, a name, an age, and a nationality.


• The airplane is characterized by an Id and a manufacturer.
• Aside from the id, the flight has a destination name, a take-off name, and a flight duration.

You might also like