Professional Documents
Culture Documents
2 Database Design
and Implementation.
Coursework.
M. M. A. Uvindu Sandasara.
Blackboard Name: - Men Sandasara.
UOW ID: W2087738
IIT No: 20221297
Men Sandasara UOW No: W2087738 / IIT No: 20221297
Acknowledgment.
I sincerely appreciate Ms. Yaalini Balathasan, our lecturer, for his wise counsel and the clear
learning about to create database and SQL. Her commitment to creating a supportive learning
environment has greatly influenced how well we understand the subject.
I would also like to express gratitude to our tutorial lecturers Ms. Gayathri Senevirathne, and Ms.
Janadhi Weranja for their passion and commitment to teaching. Their thought-provoking and
captivating lectures have enhanced my education and motivated me to learn more about the
Subject.
And I want to express our gratitude to my parents for their unwavering love, sacrifices, and
support, all of which have made it possible for me to pursue my education. I am grateful for their
unwavering belief in me, which has continuously inspired me.
Table of Contents
Acknowledgment. ........................................................................................................................................ 2
List of Figures.............................................................................................................................................. 4
Problem. ....................................................................................................................................................... 1
01. ER Diagram. ................................................................................................................................... 3
Notes. ............................................................................................................................................... 5
Visualizing System Entities and Relationships. ........................................................................... 5
Assumptions. .................................................................................................................................. 6
02. DDL Statements with Insert Data. ............................................................................................... 7
03. SQL table creation and Data entering Scripts. ......................................................................... 14
Create ‘The Disaster Management System’ database................................................................. 14
Create Disaster Event table, Inserting data, and Structure output. ............................................... 15
Create Disaster Management table, Inserting data, and Structure output.................................... 17
Create Donation event table, Inserting data, and Structure output. .............................................. 19
Create Donor table, Inserting data, and Structure output. ............................................................. 21
Create Man Made disaster table, Inserting data, and Structure output. ....................................... 23
Create Natural disaster table, Inserting data, and Structure output. ............................................ 25
Create Person table, Inserting data, and Structure output............................................................. 27
Create Relief camp, Inserting data, and Structure output. ............................................................ 29
Create Volunteer, Inserting data, and Structure output................................................................. 31
04. Ten SQL query scripts................................................................................................................. 33
05. Ten SQL queries and Output...................................................................................................... 35
Query 01................................................................................................................................................. 35
Query 02................................................................................................................................................. 36
Query 03................................................................................................................................................. 37
Query 04................................................................................................................................................. 38
Query 05................................................................................................................................................. 39
Query 06................................................................................................................................................. 40
Query 07................................................................................................................................................. 41
Query 08................................................................................................................................................. 42
Query 09................................................................................................................................................. 43
Query 10................................................................................................................................................. 44
Conclusion. ................................................................................................................................................ 47
List of Figures.
Figure 1 - ER Diagram. ................................................................................................................... 3
Figure 2 - Create Database. ........................................................................................................... 14
Figure 3 - Structure of database DMS. ......................................................................................... 14
Figure 4 - Creating disaster event database. ................................................................................. 15
Figure 5 - Proof of creating disaster event database. .................................................................... 15
Figure 6 – Inserting data for disaster event. .................................................................................. 16
Figure 7 – Proof of inserting disaster event data. ......................................................................... 16
Figure 8 – Structure output of disaster event database. ................................................................ 17
Figure 9 – Create disaster management database. ........................................................................ 17
Figure 10 – Proof of creating disaster management database. ...................................................... 18
Figure 11 – inserting data for disaster management. .................................................................... 18
Figure 12 – Proof of inserting disaster management data. ............................................................ 18
Figure 13 – structure output of disaster management database. ................................................... 19
Figure 14 – Creating Donation event database. ............................................................................ 19
Figure 15 – Proof of Creating donation event database. ............................................................... 20
Figure 16 – inserting donation event data. .................................................................................... 20
Figure 17 - Proof of inserting donation event data. ...................................................................... 20
Figure 18 - structure output of donation event database. .............................................................. 21
Figure 19 - Create Donor database. .............................................................................................. 21
Figure 20 - Proof of creating donor database. ............................................................................... 22
Figure 21 - inserting donor data. ................................................................................................... 22
Figure 22 - Proof of inserting donor data. ..................................................................................... 22
Figure 23 - Structure output of donor database............................................................................. 23
Figure 24 - Create Man made disaster database. .......................................................................... 23
Figure 25 - Proof of Creating man-made disaster database. ......................................................... 24
Figure 26 - Inserting man-made disaster data. .............................................................................. 24
Figure 27 - Proof of inserting man-made disaster data. ................................................................ 24
Figure 28 - structure output of man-made disaster database. ....................................................... 25
Figure 29 - creating natural disaster database. .............................................................................. 25
Figure 30 - Proof of creating natural disaster database. ................................................................ 26
Figure 31 - Inserting natural disaster data. .................................................................................... 26
Figure 32 - Proof of inserting natural disaster data. ...................................................................... 26
Figure 33 - structure output of natural disaster database. ............................................................. 27
Figure 34 - Creating person database. ........................................................................................... 27
Figure 35 - Proof creating person database. .................................................................................. 28
Figure 36 - Inserting person data. ................................................................................................. 28
Figure 37 - Proof of inserting person data. ................................................................................... 28
Figure 38 - structure output of person database. ........................................................................... 29
Figure 39 - Creating relief camp database. ................................................................................... 29
Problem.
Coursework Case Study - The Disaster Management System.
Sri Lanka, being a tropical island in the Indian Ocean, is prone to various natural disasters such as
floods, landslides, cyclones, and droughts. The Disaster Management System (DMS) is a network
responsible for managing and mitigating these disasters.
Each disaster event is recorded with unique characteristics such as a unique identification number,
the type of disaster (flood, landslide, cyclone, drought, etc.), the date it occurred, the regions
affected, the severity level, and the estimated damage cost.
Disaster events in the DMS’s records are further classified into two categories: those that are
natural disasters, with associated information including the meteorological data, geological data,
and the predicted frequency; and those that are man-made disasters, with relevant details including
the cause, the responsible parties, and the preventive measures.
The DMS meticulously maintains records of relief camps set up during these disasters, capturing
essential information including their name, location, capacity, the number of people
accommodated, the supplies available, and a contact person. It is assumed that each relief camp’s
name is unique.
Moreover, the DMS organizes various disaster management programs throughout the year. Each
of these programs is defined by a distinctive name, a commencement date, and an end date. These
programs are intrinsically linked to the disaster events they are designed to manage, forming a
dynamic and ever-evolving showcase of disaster management initiatives.
Volunteers play a crucial role in disaster management. Each volunteer is identified by a unique ID,
and their details such as name, contact information, and area of expertise are recorded. A single
relief camp can have multiple volunteers, and a volunteer can work in multiple relief camps.
Donors contribute to disaster management efforts by providing funds or supplies. Each donor is
identified by a unique ID, and their details such as name, contact information, and type of donation
are recorded. A single disaster event can have multiple donors, and a donor can contribute to
multiple disaster events.
Your task as a junior database developer at DMS is to design and develop a database system for
this problem.
Task details:
1. You are required to produce an ERD (Entity Relationship Diagram) for the case study
given using UML notation, any other notation will not be graded.
2. The ERD should represent aspects related to The Disaster Management System only.
3. For each of the entities in your model, you should clearly identify appropriate attributes
and relevant keys.
4. Relationships between entities should be clearly identified and labelled with any
assumptions fully documented.
5. You are also required to implement your design as a relational database using MySQL
database by creating appropriate SQL scripts and executing them.
6. You should populate your tables with sufficient data to demonstrate the execution of ten
relevant and useful queries.
01. ER Diagram.
Figure 1 - ER Diagram.
❖ Notes.
(1) indicates a one-to-one relationship. (*) indicates a one-to-many relationship. (0, *) indicates
zero or many relationships.
i. Disaster Event
➢ A disaster event can be either a natural disaster or a man-made disaster. It has a
one-to-one relationship with both entities.
ii. Natural Disasters
➢ A natural disaster is a type of disaster event.
iii. Man Made Disasters
➢ A man-made disaster is also a type of disaster event.
iv. Disaster Management
➢ A disaster management program can manage multiple disaster events.
v. Relief Camp
➢ A relief camp is associated with one or more disaster events.
➢ A relief camp may have volunteers assisting in its operation.
vi. Person
➢ A person can be a volunteer for multiple relief camps.
vii. Volunteer
➢ A volunteer can work at one or more relief camps.
viii. Donation Event
➢ A donation event is associated with one or more donors.
ix. Donor
➢ A donor can make donations at multiple donation events.
Using UML notation and connecting the entities with the proper cardinality indicators to indicate
the relationships' nature, we may depict these relationships in the ERD with these linkages in mind.
❖ Assumptions.
Create Man Made disaster table, Inserting data, and Structure output.
10. *Query to Find Persons Volunteering and Their Assigned Relief Camps:*
SELECT p.Name AS VolunteerName, r.Name AS ReliefCamp
FROM person p
JOIN relief_camp r ON p.Name = r.PersonName;
Query 01.
Query 02.
Query 03.
Query 04.
Query 05.
Query 06.
Query 07.
Query 08.
Query 09.
Query 10.
Conclusion.
This page presents the Disaster Management System, which offers a complete framework for
handling and reacting to many types of disasters. by combining important organizations like
disaster events, disaster management, relief camps, volunteers, and donors. An effective
foundation for anticipatory disaster preparedness, response, and recovery is offered by the
disaster management system. utilizing technology and cross-organizational cooperation.
By providing prompt access to pertinent data, disaster response planning, resource allocation,
and general coordination activities, the SQL queries support efficient decision-making processes.
Through the utilization of these inquiries, interested parties can acquire a more profound
comprehension of the functions of the Disaster Management System and make knowledgeable
choices to lessen the consequences of calamities and assist impacted areas.