Vous êtes sur la page 1sur 28

Topic 01

Introduction to Databases - practical

Ivana Štrumberger, MSc


istrumberger@singidunum.ac.rs
Faculty of Technical Sciences, Singidunum University
Database Systems
2018/19
Notation used in presentations

▪ Each assignment follows topics from lecture presentations.

▪ Assignments within each topic are divided into Exercises (Exercise 1,2,3
etc.) and Solutions (Solution 1,2,3 etc.).

▪ Important terms are given in this type of textbox.

▪ SQL code is given in this type of textbox.

Note
▪ Notes and remarks are given in callouts like this

2
3

Exercise 1
• The goal of this exercise is to successfully evaluate the data that ought to
be captured to build a simple and efficient System.

“ABC School District would like to create a student on-line information and
registration system to capture student-related information. The system
needs to be designed as an on-line process to allow all new students to
register on-line. It should also allow existing students to update and review
all information.”

Create a list of important data that would need to be captured and stored in
the student registration database.
4

Solution Exercise 1
1. Student Registration System

A list of data that would need to be captured in the student registration


system includes:

• Student login
• Term data, including dates
• Class schedules for each term
• Course catalogue information
• Exam schedule
• Student data
• Student services
• Transcript details
5

Exercise 2
• The goal of this exercise is to successfully evaluate the data that ought to
be captured to build a simple and efficient System.

“XYZ community would like to create a library management system. The


objective is for the database to handle all transactions for the library. The
database needs to store all the data that is relevant to managing the books,
managing customers, and the day-to-day activities of the library.”

Create a list of important data that would need to be captured and stored in
the library management database.
6

Solution Exercise 2
2. Library Management System

A list of data that would need to be captured in the library management


system includes:

• Book data
• Member data
• Books on loan data
• Book purchases
• Book inventory data
• Cash transactions
7

Exercise 3
• In this practice you need to identify the type of database model depicted
in the given model snapshots of the XYZ System.
8

Exercise 3
• In this practice you need to identify the type of database model depicted
in the given model snapshots of the XYZ System.
9

Exercise 3
• In this practice you need to identify the type of database model depicted
in the given model snapshots of the XYZ System.
10

Exercise 3
• In this practice you need to identify the type of database model depicted
in the given model snapshots of the XYZ System.
11

Exercise 3
• In this practice you need to identify the type of database model depicted
in the given model snapshots of the XYZ System.
12

Solution Exercise 3
a) The snapshot depicts an example of Hierarchical model where the root
node represents the entity which is Employee Type. Each parent node
has child nodes. For example the parent node “Part-Time" has two child
nodes.

b) The snapshot depicts an example of a network model that stores


information about customers and the details of their bank account.
Records are connected with one another through links.
13

Solution Exercise 3
c) The snapshot shows an Object-Oriented model that depicts an Employee
class:

• Employee class defined with two attributes


o Id, which is the customer identifier
o lastName, which is the name of the employee

• The Employee class has two methods


o getId()
o setId(String anId)

• The id attribute and the getId() method are private and hence can be
accessed only from within the class. The lastName attribute and the
setId(String anId) method are public and can be accessed by other classes
too.
14

Solution Exercise 3
d) The snapshot depicts a table in a relational model that stores the customer
account information of an organization. Each row or tuple of the table is
uniquely identified by the Account ID. Each cell in the table holds a single
value.

e) The snapshot depicts an example where the details of books and authors
are stored in a flat file. You will notice that both the details of the book as
well as author is stored in this flat file and there is a repetition of values.
15

Exercise 4
• In this practice you need to analyze the given table structure and bring the
table to the specified normal form.

1. Analyze the given denormalized table. The table holds information specific
to items such as the Item ID, Color of the item, and the Unit price of each of
the item. Some of the rows in the table have repeating group of information.
Evaluate the data in the table and bring the table to first normal form:
16

Exercise 4
• In this practice you need to analyze the given table structure and bring the
table to the specified normal form.

2. Analyze the given table. The table is in the first normal form and has
composite primary key made up of the Suppler ID and Store Id. The non-key
attribute location is only dependent on the Store ID.
Evaluate the data in the table and bring the table to first normal form:
17

Exercise 4
• In this practice you need to analyze the given table structure and bring the
table to the specified normal form.

3. Analyze the given table and the data stored. In the table the Book ID is the
primary key and the Category Description is dependent on the Category ID.
Evaluate the data stored in the table and eliminate the
transitive dependency to bring the table to the third normal form:
18

Solution Exercise 4
1. Solution: The table is not in first normal form because the column Color
contains multiple values. For example, the first row includes values "Red" and
"Blue". A table is said to be in 1NF if
• There are no duplicate rows
• The data is atomic (each cell is single-valued)
To bring this table to first normal form, we split the table into two tables:
19

Solution Exercise 4
2. Solution: The table has a composite primary key- Supplier ID, Store ID. The
non-key attribute is Location. Here the non-key attribute, Location, depends
only on the Store ID, which is only part of the primary key. Hence, this table
does not satisfy the rules of the second normal form.
To bring this table to second normal form, we split the table into two tables:
20

Solution Exercise 4
3. Solution: In the table, the Book ID determines Category ID, and the
Category ID determines the Category Desc. Hence, Book ID determines
Category Desc through Category ID. You will notice that there is a transitive
functional dependency, and the table does not satisfy third normal form. In
other words, each column must depend directly on the primary key. All
attributes that are not dependent upon the primary key must be removed.
21

Exercise 5
• In this practice you need to analyze the case scenario provided and
identify business rules.

1. “LibBook is a successful digital library that rents CDs and provides access to
Internet for browsing their repository of articles and magazines. With the growing
business, LibBook needs to enhance their information system to support proposed
changes to the business. LibBook attracts new members easily and the number of
members is growing rapidly. The membership base is not stable, however, which is
a cause for concern. The main idea is to introduce the concept of membership at
LibBook. Members will pay a membership fee and initially, there will be three
types of membership (corporate, student, individual) although more may be
introduced later. Student membership is free. Corporate and Faculty memberships
incur a fee but entitle the member to privileges. The type of membership can be
changed only if sufficient justification is provided.”

Your task is to identify the business rules and the associated constraint from
the case scenario described.
22

Solution Exercise 5
• Possible Solution: The business rules and constraints identified are:

• Business Rule
-Members will pay membership fees
-Student membership is free. Corporate and Individual incur a fee

• Constraint:
-Members can belong to one of the three types of membership - student,
corporate or individual
-Type of membership can be changed based on justification provided.
23

Exercise 5
• In this practice you need to analyze the case scenario provided and
identify business rules.

2. “Star Care hospital is a multi specialty hospital that caters to needs of


different patients. Every doctor registered with this hospital is assigned a
unique ID that starts with the letter "DC". The hospital ensures that the
doctors associated with them have a minimum of seven years of working
experience. Every patient is required to register with the hospital on their
first visit.
When a patient arrives, a unique patient number starting with the letters
"PT" is assigned to him/her.”

Your task is to identify the business rules and the associated constraint from
the case scenario described.
24

Solution Exercise 5
• Possible Solution: The business rules and constraints identified are:

• Business Rule:
-Doctors need to register with the hospital.
-Each doctor is assigned a unique ID starting with the letters “DC”
-Patients must register with the hospital on their first visit.

• Constraint:
- Doctors need to have a minimum of seven years of working experience
QUESTIONS?

25
References
1. Oracle Academy courseware (Database Foundations and Database
Design and Programming with SQL), 2015.
2. Burleson, K. D., Physical Database Design Using Oracle (Foundations of
Database Design), 1st Edition, Auerebach Publications, 2006, p. 247.

26
IMPORTANT NOTICE!
Ova prezentacija je nekomercijalna.
Slajdovi mogu da sadrže materijale preuzete sa Interneta, stručne i naučne
građe, koji su zaštićeni Zakonom o autorskim i srodnim pravima. Ova
prezentacija se može koristiti samo privremeno tokom usmenog izlaganja
nastavnika u cilju informisanja i upućivanja studenata na dalji stručni,
istraživački i naučni rad i u druge svrhe se ne sme koristiti –
Član 44 - Dozvoljeno je bez dozvole autora i bez plaćanja autorske naknade za nekomercijalne svrhe nastave:
(1) javno izvođenje ili predstavljanje objavljenih dela u obliku neposrednog poučavanja na nastavi;
- ZAKON O AUTORSKOM I SRODNIM PRAVIMA ("Sl. glasnik RS", br. 104/2009 i 99/2011)
.................................................................................................................................................................................
Ivana Štrumberger
istrumberger@singidunum.ac.rs

27
Topic 01
Introduction to Databases - practical

Thank you for attention!


Ivana Štrumberger, MSc
istrumberger@singidunum.ac.rs
Faculty of Technical Sciences, Singidunum University
Database Systems
2018/19

Vous aimerez peut-être aussi