Sunteți pe pagina 1din 46

Database

Systems:
Data Centers,
Data Modeling
and Relational
Database
Russel G. Reyes
Lesson Objectives

After completing this lesson, you will be


able to:
• Define general data management concepts
and terms
• Describe logical and physical database
design considerations and the relational
database model
• Identify the common functions performed
by all database management systems
Database Systems

• Database:
– Organized collection of data

• Database management system (DBMS):


– Group of programs that manipulate the database
– Provide an interface between the database and its
users and other application programs

• Database administrator (DBA):


– Skilled IS professional who directs all activities
related to an organization’s database
Data Management

• Without data and the ability to process it:


– An organization could not successfully
complete most business activities

• Data is consists of raw facts


• To transform data into useful information:
– It must first be organized in a meaningful
way
The Hierarchy of Data

• Bit (a binary digit):


– Circuit that is either on or off
• Byte:
– Typically made up of eight bits
• Character:
– Basic building block of information
• Field:
– Name, number, or combination of characters that
describes an aspect of a business object or
activity
The Hierarchy of Data

• Record:
– Collection of related data fields
• File:
– Collection of related records
• Database:
– Collection of integrated and related
files
The Hierarchy of Data
Data Entities, Attributes,
and Keys

• Entity:
– A person, place, or thing for which data is
collected, stored, and maintained
• Attribute:
– Characteristic of an entity
• Data item:
– Specific value of an attribute
Data Entities, Attributes,
and Keys

The key field is the employee number. The attributes


includes last name, first name, hire data and dept. number.
Data Entities, Attributes,
and Keys

• Key:
– Field or set of fields in a record that is
used to identify the record

• Primary key:
– Field or set of fields that uniquely
identifies the record
The Database Approach

• The database approach:


– Traditional approach to data management:
• Each distinct operational system used data files
dedicated to that system

– Database approach to data management:


• Pool of related data is shared by multiple
application programs
Components of a Database
System
The Database Approach to
Data Management
Data Centers, Data Modeling and
Database Characteristics

When building a database, an organization must


consider:
• Content: What data should be collected and at
what cost?
• Access: What data should be provided to which
users and when?
• Logical structure: How should data be arranged
so that it makes sense to a given user?
• Physical organization: Where should data be
physically located?
Data Center

• Climate-controlled building or set of buildings


that house database servers and the systems
that deliver mission-critical information and
services.

Traditional data centers:


Consist of warehouses
filled with row upon row of
server racks and powerful
cooling systems.
Data Modeling

• Data model:
– Diagram of data entities and their relationships

• Enterprise data modeling:


– Starts by investigating the general data and
information needs of the organization at the
strategic level

• Entity-relationship (ER) diagrams:


– Data models that use basic graphical symbols to
show the organization of and relationships
between data
Entity-relationship (ER) diagram for a
customer order database
What is an ER diagram?

• An Entity Relationship Diagram (ERD) is a visual


representation of different entities within a system and
how they relate to each other. For example, the elements
writer, novel, and a consumer may be described using
ER diagrams the following way:
• For example, an inventory software used in a retail shop
will have a database that monitors elements such as
purchases, item, item type, item source and item price.
Rendering this information through an ER diagram would
be something like this:
ER Diagram Symbols and
Notations
Weak Entity
• A weak entity is an entity that depends on the existence
of another entity. In more technical terms it can be
defined as an entity that cannot be identified by its own
attributes. It uses a foreign key combined with its
attributed to form the primary key. An entity like order
item is a good example for this. The order item will be
meaningless without an order so it depends on the
existence of the order.
Attribute
• An attribute is a property, trait, or characteristic of an
entity, relationship, or another attribute. For example, the
attribute Inventory Item Name is an attribute of the entity
Inventory Item. An entity can have as many attributes as
necessary. Meanwhile, attributes can also have their
own specific attributes. For example, the attribute
“customer address” can have the attributes number,
street, city, and state. These are called composite
attributes.
Multivalued Attribute

• If an attribute can have more than one value it is called a


multi-valued attribute. It is important to note that this is
different from an attribute having its own attributes. For
example, a teacher entity can have multiple subject
values.
Derived Attribute

• An attribute based on another attribute. This is


found rarely in ER diagrams. For example, for a
circle, the area can be derived from the radius.
Relationship

• A relationship describes how entities interact. For


example, the entity “Carpenter” may be related to the
entity “table” by the relationship “builds” or “makes”.
Relationships are represented by diamond shapes and
are labeled using verbs.
Recursive Relationship

• If the same entity participates more than once in a


relationship it is known as a recursive relationship. In the
below example an employee can be a supervisor and be
supervised, so there is a recursive relationship.
Relational Databases

• A relational database stores information in


tables. Each informational theme is stored
in its own table.

• In essence, a relational database will break-


up a list into several parts. One part for
each theme in the list
The Relational Database Model

Relational model:
• Describes data using a standard tabular
format
• Each row of a table represents a data entity
(record)
• Columns of the table represent attributes
(fields)
• The domain is the range of allowable values
for data attributes
Tables as Database Objects

• One database can hold many tables


• The tables hold different kinds of data
• Data can be linked between tables
• The link between tables is a RELATION

Table A Table B
The Relational Database Model

In the relational model, all


data elements are placed
in two-dimensional tables,
or relations. As long as
they share at least one
common element, these
relations can be linked to
output useful information.
The Relational Database Model

Simplified ER diagram showing the


relationship between the manager,
department and project tables
The Relational Database Model
What does Related means?

• When we say the two TABLES are “related”,


we really mean certain RECORDS in the two
tables are related.

• Ability to relate records in multiple tables


gives relational databases their power.
Foreign Key

• A table may be related to other tables (i.e., a


relationship). To create relationships, you may
need to create a foreign key.

A foreign key is a primary key from one


table placed into another table.

Referential integrity - every value of a


foreign key must match a value of an
existing primary key.
Foreign Key Example

Project
Manager
Proj_Num
MgrID Primary Key
Proj_Name
MgrName
MgrID
Foreign Key
Types of Database Relationship

• One-to-one relationship. If your data


requires that one record in the parent table be
related to only one record in the child table,
you have a one-to-one model. The most
common use of one-to-one relations is to
create separate entity classes to enhance
security.
Types of Database Relationship

Table A Table B

Record 1 Record 1
Record 2 Record 2

Record 3 Record 3
Record 4
Record 4

One-to-one relationship
Types of Database Relationship

• One-to-many relationship. The most


common relational model is one where a
single record in the parent table relates to
multiple records in the child table. This is
called a one-to-many relationship.
Types of Database Relationship

Table A Table B
Record 1A
Record 1B
Record 1 Record 1C

Record 2A
Record 2 Record 2B

Record 3A
Record 3 Record 3B
Record 3C
Record 3D
Record 4 Record 4A
Record 4B

One-to-Many Relationship
Types of Database Relationship

• Many-to-many relationship. In some cases,


you might have data in which many records
in one table can relate to many records in
another table. This is called a many-to-
many relationship. In this case, there is no
direct way to establish a common field
between the two tables.
Types of Database Relationship

Table B Table A
Table D

Table C

Lookup
Table E Many-to-Many Relationship
Data modelling using ERD with
Crow Foot Notation

• The understanding of relationship and


cardinality/multiplicity between entities are vital
in modelling a database system. When it comes
to relationship between entities, one of the
following three relationships can exist between
two entities.
– One to One
– One to Many
– Many to Many
Examples:

• A car needs a tax disc (One to One),


• A car has four wheels (One to Many)
• A car can carry more than one person
(One to Many)
• A driver is allowed to drive more than one
car and a car can be driven by more than
one driver (Many to Many).
Crow Foot Notation Symbols
Example

Many-to-
One-to-one many

One-to-many One-to-many
SUMMARY

• Data management and modeling are key


aspects of organizing data and information

• A well-designed and well-managed database is


an extremely valuable tool in supporting decision
making

• The number and types of database applications


will continue to evolve and yield real business
benefits

S-ar putea să vă placă și