Week 1 Activity Sheet:: Defining A Database
Week 1 Activity Sheet:: Defining A Database
Week 1 Activity Sheet:: Defining A Database
DEFINING A DATABASE
Databases - Collection of related data that is stored in a central location or in multiple locations
Data hierarchy - Structure and organization of data involving fields, records, and files
Database management system (DBMS) — Hardware/Software for creating, storing, maintaining, and
accessing database files makes using databases more efficient
Hierarchy model
ASYNCHRONOUS ACTIVITY:
DATABASE ARCHITECTURE
YOUR GOALS:
After completing the learning activities for this lesson, you are expected to:
apply the importance of DBMS to different programming language
understand the advantage of DBMS to a file system
classify the different architecture used in DBMS.
Select one of your favorite character can be an anime, or an artist local or international write
down all information available to that person or character including hobbies, personal profile,
likes and dislikes that is available on the internet, lastly answer this question why do this
information exist in the internet?
Telecom: There is a database to keeps track of the information regarding calls made, network
usage, customer details etc. Without the database systems it is hard to maintain that huge
amount of data that keeps updating every millisecond.
Industry: Where it is a manufacturing unit, warehouse or distribution center, each one needs a
database to keep the records of ins and outs. For example, distribution center should keep a
track of the product units that supplied into the center as well as the products that got
delivered out from the distribution center on each day; this is where DBMS comes into picture.
Banking System: For storing customer info, tracking day to day credit and debit transactions,
generating bank statements etc. All this work has been done with the help of Database
management systems.
Airlines: To travel though airlines, we make early reservations, this reservation information
along with flight schedule is stored in database.
Education sector: Database systems are frequently used in schools and colleges to store and
retrieve the data regarding student details, staff details, course details, exam details, payroll
data, attendance details, fees details etc. There is a hell lot amount of inter-related data that
needs to be stored and retrieved in an efficient manner.
Online shopping: You must be aware of the online shopping websites such as Amazon, Flipkart
etc. These sites store the product information, your addresses and preferences, credit details
and provide you the relevant list of products based on your query. All this involves a Database
management system.
Data redundancy: Data redundancy refers to the duplication of data, let’s say we are managing
the data of a college where a student is enrolled for two courses, the same student details in
such case will be stored twice, which will take more storage than needed. Data redundancy
often leads to higher storage costs and poor access time.
Data inconsistency: Data redundancy leads to data inconsistency, let’s take the same example
that we have taken above, a student is enrolled for two courses and we have student address
stored twice, now let’s say student requests to change his address, if the address is changed at
one place and not on all the records then this can lead to data inconsistency.
Data Isolation: Because data are scattered in various files, and files may be in different formats,
writing new application programs to retrieve the appropriate data is difficult.
Atomicity issues: Atomicity of a transaction refers to “All or nothing”, which means either all
the operations in a transaction executes or none.
For example: Let’s say Steve transfers 100 pesos to Negan’s account. This transaction consists
multiple operations such as debit 100 pesos from Steve’s account, credit 100 pesos to Negan’s
account. Like any other device, a computer system can fail let’s say it fails after first operation
then in that case Steve’s account would have been debited by 100 pesos but the amount was
not credited to Negan’s account, in such case the rollback of operation should occur to
maintain the atomicity of transaction. It is difficult to achieve atomicity in file processing
systems.
Data Security: Data should be secured from unauthorized access, for example a student in a
college should not be able to see the payroll details of the teachers, such kind of security
constraints are difficult to apply in file processing systems.
There are several advantages of Database management system over file system. Few of them
are as follows:
Data Consistency and Integrity: As we discussed earlier the root cause of data inconsistency is
data redundancy, since data normalization takes care of the data redundancy, data
inconsistency also been taken care of as part of it
Data Security: It is easier to apply access constraints in database systems so that only
authorized user can access the data. Each user has a different set of access thus data is secured
from the issues such as identity theft, data leaks and misuse of data.
Easy recovery: Since database systems keeps the backup of data, it is easier to do a full
recovery of data in case of a failure.
Flexible: Database systems are more flexible than file processing systems.
Disadvantages of DBMS:
DBMS implementation cost is high compared to the file system
Complexity: Database systems are complex to understand
Performance: Database systems are generic, making them suitable for various
applications. However, this feature affects their performance for some applications
DBMS Architecture
The architecture of DBMS depends on the computer system on which it runs. For example, in a
client-server DBMS architecture, the database systems at server machine can run several requests made
by client machine. We will understand this communication with the help of diagrams.
For example, lets say you want to fetch the records of employee from the database and the
database is available on your computer system, so the request to fetch employee details will be
done by your computer and the records will be fetched from the database by your computer as well.
This type of system is generally referred as local database system.
In two-tier architecture, the Database system is present at the server machine and the DBMS
application is present at the client machine, these two machines are connected with each other through
a reliable network as shown in the above diagram.
Whenever client machine makes a request to access the database present at server using a
query language like sql, the server perform the request on the database and returns the result back to
the client. The application connection interface such as JDBC, ODBC are used for the interaction
between server and client.
Figure 4: Three-Tier architecture
In three-tier architecture, another layer is present between the client machine and server
machine. In this architecture, the client application doesn’t communicate directly with the database
systems present at the server machine, rather the client application communicates with server
application and the server application internally communicates with the database system present at the
server.
TASK 1: In your own word, discuss the benefit of using a Database Management system from a
big data such as:
Retail
Financial services
Advertising and public relations
Government
Manufacturing
Media and telecommunications
Energy
Healthcare
Database Management systems may be used for a variety of purposes, including inventory
management for retailers and manufacturers, data evaluation, search and identification on big
databases, and data storage that is more secure than the traditional method of paper and
envelopes.
Financial services and healthcare can evaluate and identify the most needed for
attention and services faster, consistent, and with no redundancy of data.
Finally, database management systems are useful and highly reliable through vast databases,
particularly for those who have a large amount of data to manage.
TASK 2: Based on the information below of the cases of COVID-19 here in Caloocan City as of
March 2020, how do you think the LGU is able to determine the numbers or the data shown in
the image? Using the logic of Database architecture.
Figure 5: COVID-19 cases in Caloocan City as of March 2020
LGUs can use tracing systems like "ValTrace" to track, monitor, and investigate potential
COVID-19 cases. Such databases are critical for managing people's monitoring, especially
during pandemics. Looking at the cases of COVID-19 in Caloocan City as of March 2020,
you can see that they have people monitored, under investigation, and confirmed cases of
COVID-19 that are using the requisite processes for preparedness and response to COVID-19
as an opportunity to strengthen and sustain their local city surveillance.
LGUs can also use their database to determine if there is an outbreak in their region; if there
is a sudden increase in confirmed cases, they may need to increase contact tracing for a
specific region. However, without a database, it will be more difficult and time-consuming,
making it inefficient and unreliable. That is why database management systems are critical
for managing large amounts of data.
YOUR GOALS:
After completing the learning activities for this lesson, you are expected to:
understand the different structure of a database
distinguish the database structed used in a program
understand the importance of creating an architecture of database.
In our daily Internet activities, people normally use FACEBOOK, TWITTER, MICROSOFT, YAHOO
and GOOGLE as our main website to get news or any information we wanted too.
Write down the common information this website gets for us to LOGIN and WHY? Do they get
this information?
Figure 6: Internet websites
Data models define how the logical structure of a database is modeled. Data Models are fundamental
entities to introduce abstraction in a DBMS. Data models define how data is connected to each other
and how they are processed and stored inside the system.
The very first data model could be flat data-models, where all the data used are to be kept in the same
plane. Earlier data models were not so scientific; hence they were prone to introduce lots of duplication
and update anomalies.
Entity-Relationship Model
Entity − An entity in an ER Model is a real-world entity having properties called attributes. Every
attribute is defined by its set of values called domain. For example, in a school database, a
student is considered as an entity. Student has various attributes like name, age, class, etc.
Relationship − The logical association among entities is called relationship. Relationships are
mapped with entities in various ways. Mapping cardinalities define the number of associations
between two entities.
Mapping cardinalities:
one to one
one to many
many to one
many to many
Relational Model
The most popular data model in DBMS is the Relational Model. It is more scientific a
model than others. This model is based on first-order predicate logic and defines a table as an
n-array relation.
A database schema is the skeleton structure that represents the logical view of the
entire database. It defines how the data is organized and how the relations among them are
associated. It formulates all the constraints that are to be applied on the data.
A database schema defines its entities and the relationship among them. It contains a
descriptive detail of the database, which can be depicted by means of schema diagrams. It’s the
database designers who design the schema to help programmers understand the database and
make it useful.
Physical Database Schema – This schema pertains to the actual storage of data and its form of
storage like files, indices, etc. It defines how the data will be stored in a secondary storage.
Logical Database Schema – This schema defines all the logical constraints that need to be
applied on the data stored. It defines tables, views, and integrity constraints.
Database Instance
It is important that we distinguish these two terms individually. Database schema is the
skeleton of database. It is designed when the database doesn't exist at all. Once the database is
operational, it is very difficult to make any changes to it. A database schema does not contain
any data or information.
A database instance is a state of operational database with data at any given time. It
contains a snapshot of the database. Database instances tend to change with time. A DBMS
ensures that its every instance (state) is in a valid state, by diligently following all the
validations, constraints, and conditions that the database designers have imposed.
WEEK 4 ACTIVITY SHEET:
ENTITY MODEL, DATA, LOGICAL AND PHYSICAL INDEPENDENCE
YOUR GOALS:
After completing the learning activities for this lesson, you are expected to:
understand the different entity model
classify the independence of a data
able to define the attributes of a data
Any company or corporation uses an organizational chart in order to guide and inform the
employees of their role in an organization.
Search for any establishment, can be a School a private company a draw their organizational
chart
Data Independence
There's a lot of data in whole database management system other than user's data.
DBMS comprises of three kinds of schemas, which is in turn data about data (Meta-Data).
Meta-data is also stored along with database, which once stored is then hard to modify. But as
DBMS expands, it needs to be changed over the time satisfy the requirements of users. But if
the whole data were highly dependent it would become tedious and highly complex.
Data about data itself is divided in layered architecture so that when we change data at
one layer it does not affect the data layered at different level. This data is independent but
mapped on each other.
Logical data independence is a kind of mechanism, which liberalizes itself from actual
data stored on the disk. If we do some changes on table format it should not change the data
residing on disk.
For example, in case we want to change or upgrade the storage system itself, that is, using SSD
instead of Hard disks should not have any impact on logical data or schemas.
Entity
A real-world thing either animate or inanimate that can be easily identifiable and
distinguishable. For example, in a school database, student, teachers, class and course offered
can be considered as entities. All entities have some attributes or properties that give them
their identity.
An entity set is a collection of similar types of entities. Entity set may contain entities
with attribute sharing similar values. For example, Students set may contain all the student of a
school; likewise, Teachers set may contain all the teachers of school from all faculties. Entities
sets need not to be disjoint.
Attributes
Entities are represented by means of their properties, called attributes. All attributes
have values. For example, a student entity may have name, class, age as attributes.
There exist a domain or range of values that can be assigned to attributes. For example,
a student's name cannot be a numeric value. It has to be alphabetic. A student's age cannot be
negative, etc.
Types of attributes:
Simple attribute- Simple attributes are atomic values, which cannot be divided further. For
example, student's phone-number is an atomic value of 10 digits.
Composite attribute - Composite attributes are made of more than one simple attribute. For
example, a student's complete name may have first name and last name.
Derived attribute - Derived attributes are attributes, which do not exist physical in the
database, but their values are derived from other attributes presented in the database. For
example, average salary in a department should be saved in database instead it can be derived.
For another example, age can be derived from data of birth.
Multi-value attribute - Multi-value attribute may contain more than one values. For example, a
person can have more than one phone numbers, email address etc.
Super Key - Set of attributes (one or more) that collectively identifies an entity in an entity set.
Candidate Key - Minimal super key is called candidate key that is, supers keys for which no
proper subset are a superkey. An entity set may have more than one candidate key.
Primary Key - This is one of the candidate key chosen by the database designer to uniquely
identify the entity set.
Relationship
The association among entities is called relationship. For example, employee entity has
relation works at with department. Another example is for student who enrolls in some course.
Here, Works at and Enrolls are called relationship.
Relationship Set
Relationship of similar type is called relationship set. Like entities, a relationship too can
have attributes. These attributes are called descriptive attributes.
Degree of relationship
The number of participating entities in an relationship defines the degree of the
relationship.
Binary = degree 2
Ternary = degree 3
n-array = degree
Mapping Cardinalities:
Cardinality defines the number of entities in one entity set which can be associated to
the number of entities of other set via relationship set.
One-to-one: one entity from entity set A can be associated with at most one entity of entity set
B and vice versa.
One-to-many: One entity from entity set A can be associated with more than one entities of
entity setB but from entity set B one entity can be associated with at most one entity.
Figure 13: One to many entity
Many-to-one: More than one entities from entity set A can be associated with at most one
entity of entity set B but one entity from entity set B can be associated with more than one
entity from entity set A.
Many-to-many: one entity from A can be associated with more than one entity from B and vice
versa.
Figure 15: Many to many entity
ER Diagram Representation
Now we shall learn how ER Model is represented by means of ER diagram. Every object
like entity, attributes of an entity, relationship set, and attributes of relationship set can be
represented by tools of ER diagram.
Entity
Entities are represented by means of rectangles. Rectangles are named with the entity
set they represent.
Attributes
Attributes are properties of entities. Attributes are represented by means of eclipses.
Every eclipse represents one attribute and is directly connected to its entity (rectangle).
Figure 17: Sample attributes
If the attributes are composite, they are further divided in a tree like structure. Every
node is then connected to its attribute. That is composite attributes are represented by eclipses
that are connected with an eclipse.
Relationship
Relationships are represented by diamond shaped box. Name of the relationship is
written in the diamond-box. All entities (rectangles), participating in relationship, are connected
to it by a line.
Binary relationship and cardinality
A relationship where two entities are participating, is called a binary relationship.
Cardinality is the number of instance of an entity from a relation that can be associated with
the relation.
One-to-one
When only one instance of entity is associated with the relationship, it is marked as '1'.
This image below reflects that only 1 instance of each entity should be associated with the
relationship. It depicts one-to-one relationship
One-to-many
When more than one instance of entity is associated with the relationship, it is marked
as 'N'. This image below reflects that only 1 instance of entity on the left and more than one
instance of entity on the right can be associated with the relationship. It depicts one-to-many
relationship.
Many-to-one
When more than one instance of entity is associated with the relationship, it is marked
as 'N'. This image below reflects that more than one instance of entity on the left and only one
instance of entity on the right can be associated with the relationship. It depicts many-to-one
relationship
Participation Constraints
Total Participation - Each entity in the entity is involved in the relationship. Total participation
is represented by double lines.
Partial participation - Not all entities are involved in the relationship. Partial participation is
represented by single line.
TASK 1: Given the following field below write down your personal information using MS
ACCESS Database.
Figure 26: MS ACCESS DB
TASK 2: In your Visual basic create a simple program that can store the following information.
References:
https://beginnersbook.com/2015/04/dbms-tutorial/
https://www.tutorialspoint.com/dbms/dbms_data_schemas.htm
https://www.guru99.com/dbms-tutorial.html
https://www.studytonight.com/dbms/
http://www.ssmargolcollege.org/style/notes/computer%20science/
Database_Management_System.pdf
https://www.db-book.com/db4/slide-dir/ch1-2.pdf
WEEK 5 ACTIVITY SHEET:
AGGREGATION, CODD’S RULES AND DATA MODEL RELATION
YOUR GOALS:
After completing the learning activities for this lesson, you are expected to:
design a database system using MS Access
enumerate the importance codd’s rules in database
compare different data model how does it use to different program.
Companies often collect data on their online customers and website visitors. The
aggregate data would include statistics on customer demographic and behavior metrics, such as
average age or number of transactions. This aggregated data can be used by the marketing
team to personalize messaging, offers, and more in the user’s digital experience with the brand.
Create a simple survey using “MS FORMS” to get the following information
Gender
Age
Internet connection
Hobby
Interest
How often do you surf the internet?
Do you do online shopping?
YOUR DISCUSSION TEXT:
Generalization Aggregation
Generalization
As mentioned above, the process of generalizing entities, where the generalized entities
contain the properties of all the generalized entities is called Generalization. In generalization,
several entities are brought together into one generalized entity based on their similar
characteristics. For an example, pigeon, house sparrow, crow and dove all can be generalized as
Birds.
Specialization
Specialization is a process, which is opposite to generalization, as mentioned above. In
specialization, a group of entities is divided into sub-groups based on their characteristics. Take
a group Person for example. A person has name, date of birth, gender etc. These properties are
common in all persons, human beings. But in a company, a person can be identified as
employee, employer, customer or vendor based on what role do they play in company.
Similarly, in a school database, a person can be specialized as teacher, student or staff; based
on what role do they play in school as entities.
Inheritance
We use all above features of ER-Model, in order to create classes of objects in object-
oriented programming. This makes it easier for the programmer to concentrate on what she is
programming. Details of entities are generally hidden from the user, this process known as
abstraction.
One of the important features of Generalization and Specialization, is inheritance, that
is, the attributes of higher-level entities are inherited by the lower level entities.
For example, attributes of a person like name, age, and gender can be inherited by lower level
entities like student and teacher etc.
Codd's 12 Rules
Dr Edgar F. Codd did some extensive research in Relational Model of database systems
and came up with twelve rules of his own which according to him, a database must obey in
order to be a true relational database.
These rules can be applied on a database system that is capable of managing is stored
data using only its relational capabilities. This is a foundation rule, which provides a base to
imply other rules on it.
Concepts
Tables - In relation data model, relations are saved in the format of Tables. This format stores
the relation among entities. A table has rows and columns, where rows represent records and
columns represents the attributes.
Tuple - A single row of a table, which contains a single record for that relation is called a tuple.
Relation instance - A finite set of tuples in the relational database system represents relation
instance. Relation instances do not have duplicate tuples.
Relation schema - This describes the relation name (table name), attributes and their names.
Relation key - Each row has one or more attributes which can identify the row in the relation
(table) uniquely, is called the relation key.
Attribute domain - Every attribute has some pre-defined value scope, known as attribute
domain.
Constraints
Every relation has some conditions that must hold for it to be a valid relation. These
conditions are called Relational Integrity Constraints. There are three main integrity constraints.
Key Constraints
Domain constraints
Referential integrity constraints
Key Constraints
There must be at least one minimal subset of attributes in the relation, which can
identify a tuple uniquely. This minimal subset of attributes is called key for that relation. If there
are more than one such minimal subsets, these are called candidate keys.
Domain constraints
Attributes have specific values in real-world scenario. For example, age can only be
positive integer. The same constraints have been tried to employ on the attributes of a relation.
Every attribute is bound to have a specific range of values. For example, age cannot be less than
zero and telephone number cannot be an outside 0-9.
References:
https://beginnersbook.com/2015/04/dbms-tutorial/
https://www.tutorialspoint.com/dbms/dbms_data_schemas.htm
https://www.guru99.com/dbms-tutorial.html
https://www.studytonight.com/dbms/
termux