Transcript database

EAK 362/2 MIS
LECTURE 4 PART 1
DataBase Management Systems
Introduction to Database Technology
Database
An organized collection of logically related data.
•Usually owned by a single enterprise or organization
•Contain facts the enterprise or organization cares about
The data items can be text, numbers, dates, sound file, music, v
among others.
Database System
A database system is essentially nothing more than a computerized
record-keeping system. Many of the data files traditionally kept on
paper or in flat files could more conveniently be kept in a database.
Database application example:
Using an ATM
•A database in the bank keeps data about your account
•Passwords are verified to allow transactions to be done
on your account
•Transactions are recorded in the central database of the
bank
•Ensures that no two transactions can be done in parallel
in a way that create anomalies
Database application example:
Purchasing from a supermarket
•The supermarket database keeps data such as product
bar codes, product names, and price.
•Products are scanned at the checkout counter and is
looked up for the price.
•Promotion discount information are also kept.
•The database is also used in acquisition of products by
the supermarket.
Data as a Resource
• One of the most vital corporate resources
• Used for planning and decision making
• Measurement of performance and profitability
• Integrated into product design and marketing
DATA IS A CORPORATE ASSET
Metadata
Data that describe the properties or characteristics of other
data, it is data about data.
Database Management System
A general-purpose commercial software system used to define,
create, maintain, and provide controlled access to the database.
Traditional File Processing Systems
•
•
•
•
•
focused on the needs of individual departments
custom development for each application
used flat files, usually sequentially accessed
reliance on central IS personnel
no reuse
A file is a collection of related records.
Disadvantages of File Processing Systems
•
•
•
•
•
•
•
Program-data dependence
Duplication of data
Limited data sharing
Lengthy development time
Excessive program maintenance
No “Overall Map” - single view
Application-oriented development
The Database Approach
Goal
The integration and sharing
of data throughout the
organization
Managing Databases
Section A File and Database Concepts



The term data file has multiple definitions.
You can use clues from the context of the
sentence it is used in to decide what it
means.
Data management refers to the tasks
associated with maintaining and accessing
the data stored in a data file.
Each data file has a file structure that
describes the way in which the data is
stored in that file.
Section A File and Database Concepts
Section A
A file contains
records that
are made up of
fields
Fields
What is the basic building block for a data file?




A field contains the smallest unit of
meaningful data and can be thought of as
the basic building block for a data file.
Each field has a field name that describes
its contents.
A variable-length field expands to fit the
data you enter.
A fixed-length field contains a
predetermined number of bytes.
Data Types
Are there any special rules about the data I can
enter in a field?

The data type specifies the way data is
represented on the disk and in RAM.


every field in a file is assigned a data type
A numeric data type is assigned to fields
containing numbers.


a real number contains a decimal point
an integer is a whole number
Data Types
Are there any special rules about the data I can
enter in a field?

A character data type is assigned to
fields containing data that does not have to
be manipulated mathematically.




names, cities, telephone numbers
The date data type is used when you
want to manipulate dates.
The logical data type is used to store
true/false or yes/no data.
A memo data type is used for entering
comments.
Records
What is the relationship between an entity and
a record?


An entity is a person, place, thing or
event.
A record contains fields of data
about one entity.
Flat Files
Do all of the records in a data file contain the
same fields?

A flat file is sometimes used to refer
to a data file in which all records have
same field names, field lengths, and
data types.



single record type
used when you want a single file and
not a database
not efficient for complex data
management tasks
Flat Files
Do all of the records in a data file contain the
same fields?
Using two flat files to
calculate pay requires
the computer to work
back and forth
between the two files.
Databases
Does a database offer flexibility for using more
than one file?


A database has many definitions. It is
a term that is used loosely.
An accurate definition of a database
is a variety of different record types
that are treated as a single unit.
Databases
Does a database offer flexibility for using more
than one file?
When a computer uses
related record types from a
database to calculate pay, it
can combine two
records to create a record that
contains the data from both
files.
Databases
Does a database offer flexibility for using more
than one file?


A database has more flexibility than a
flat file but is more difficult to design
and maintain.
A database administrator
supervises database design,
development, testing, and
maintenance.
Section B Data Models

A data model is a description of the
way that data is stored in a database.


helps you understand the relationships
between entities
helps you create efficient structure to hold
your data
Entity Relationships
How does a data model describe data?


A relationship is an association
between entities.
Database designers graphically depict
data models using diagramming
techniques.
Entity Relationships
How does a data model describe data?


A data diagram can also show
cardinality – the number of
occurrences that can exist between two
record types.
Three possible types of cardinality are:



one-to-one
one-to-many
many-to-many
Entity Relationships
How does a data model describe data?
Diagramming cardinality
Employee
Social Security
Card
A one-to-one relationship
is shown by using a single
line to connect the boxes
that represent record
types.
Employee
Employee
Timecard
Job
A one-to-many
relationship is shown by
adding a “crow’s foot” to
the end of the line next to
the record type with many
occurrences.
A many-to-many
relationship is shown
by adding a “crow’s
foot” to both ends of the
connecting line.
Entity Relationships
How does a data model describe data?



One-to-one relationship = one record of a
record type is related to only one record of
another record type
One-to-many relationship = one record in
a record type may be related to more than
one record of another record type
Many-to-many relationship = one record
in a particular record type can be related to
many records in another record type and vice
versa
Entity Relationships
How does a data model describe data?
Data diagram
An Employee has many
Timecards.
A Job is held by many Employees.
Each Department has
many Employees.
A many-to-many
relationship exists
between Job and
Department.