DBMS 2
Data vs. information:
• What is data? • What is information?
o unprocessed o information is data that have
information. been organized and
communicated in a coherent
and meaningful manner.
o Data is converted into
information, and information is
converted into knowledge.
o Knowledge; information
evaluated and organized so
that it can be used
purposefully.
data information knowledge
Data Base
• Data + Base = Data Base
• Allows easy and efficient storage, retrieval,
and modification of data.
• Computerized record keeping System.
What is a database?
• Collection of related files containing records on
people, places, or things.
• Databases make data easy to access and
manage.
• A database is a logically coherent, organized
collection of similar or related data.
Examples :
• a telephone book
• Employee data base
Why do we need a
database?
• Keep records
• Develop reports
• Perform research
Database
Database:
Collection of
data organized
in different
containers
Basic database terms
• Field/Column: one related part of table and
smallest logical structure of storage in
database
• Record/row : one piece of data. Collection of
multiple related fields
• Table: collection of logically related multiple
records
• Data type: Character, Numeric, date, time, etc
Basic Concepts of DBMS
Accounts ( table)
Each table has:
• Fields
• Records
• 1 Primary key
• Table: Two-dimensional structure composed of rows
and columns
• Field: Like a column in a spreadsheet
• Field name: like a column name in a spreadsheet
• Field values: Actual data for the field
• Record: Set of fields that describe an entity (a person,
an account, etc.)
• Primary key: A field, or group of fields, that uniquely
identifies a record
Keys in Data base
Primary key
A Primary key could be a single field like in these tables.
Keys in Data base
A Primary key could be a composite key, i.e. multiple
fields
Key in Database
• Foreign Key: Fields in a table that refer to
the primary key in another table.
o The data in this field must exactly match data
contained in the primary key field.
• Candidate key: is a key that can be used to
uniquely identify a record, it may be used to
retrieve one specific record.
o E.g: employee code no.
Logical data concepts
• Entity
• Attribute
• Relationship
Entity
• An entity, sometimes called a table, could be
o a person
o a place
o a thing
o a transaction
o an event
Attributes
• Also called fields or columns, Attributes are
characteristics of an entity.
• An entity identifier is the attribute that ensures
that each instance of the entity is unique
Entity Instance
An entity instance is like a record.
Example:
Relationships
• The relationships stored in a database are
between instances of entities.
• One-to-One (1:1)
o An instance of entity A can be related to only
one instance of entity B
• One-to-Many (1:M)
o An instance of entity B can be related to many
instances of entity A
Relationships (cont)
• The relational model cannot handle Many-to-
Many (M:M) relationships directly
• It is limited to 1:1 and 1:M relationships
• M:M relationships need to be replaced with a
collection 1:M relationships
Entity-Relationship Diagram (ERD)
• ERD or schema is a complete diagram
representing the overall, logical plan of a
database.
Data dictionary
• The data dictionary is a file that stores definitions of
information types, identifies the primary and foreign
keys, and maintains the relationships among the
tables.
Traditional File Systems
• System of files that store groups of records used
by a particular software application
• Simple but with a cost
o Inability to share data
o Inadequate security
o Difficulties in maintenance and expansion
o Allows data duplication (e.g. redundancy)
Traditional File System Anomalies
• Insertion anomaly
o Data needs to be
entered more than once
if located in multiple file
systems
• Modification anomaly
o Redundant data in
separate file systems
o Inconsistent data in
your system
• Deletion anomaly
o Failure to
simultaneously delete
all copies of redundant
data
Database system environment
DBMS
• Combination of software and data for
o Collecting, storing and managing data in a
database environment.
• A DBMS includes:
o Database
o Database engine (for accessing and modifying
the DB content)
o Data Manipulation Language
DBMS
• A database management system (DBMS) is
simply the software that permits an
organization to centralize data, manage them
efficiently, and provide access to the stored
data by application programs
• an interface between application programs
and the physical data files.
DBMS Functions
• Guarantee the integrity and consistency of data.
It has several functions:
1. Data dictionary management: (the definition
of the data elements and their relationships
are stored in a data dictionary). It remove
data and structure dependencies.
2. Data storage management: structures
required for data storage
3. Data transformation and presentation:
relieving us from the distinct between logical
data format and physical data format
4. Security management
5. Multiuser access control (concurrency)
Objectives of DBMS
1. Creates and maintains databases
2. Eliminates requirement for data definition
statements
3. Acts as interface between application
programs and physical data files
4. Separates logical and design views of data
Advantages of DBMS
• Reduction in Data Redundancy
• Reduction in Data Inconsistency
• Sharing of data
• Enforcement of standards
• Improvement in data security
• Management of data integrity
• Better interaction with users
• Efficient system
Disadvantages of DBMS
1. Main inhibitors (costs) of using a DBMS:
• High initial investment and possible need for
additional hardware.
• Overhead for providing generality, security,
recovery, integrity, and concurrency control.
Disadvantages of DBMS
2. When a DBMS may be unnecessary:
• If the database and applications are simple,
well defined, and not expected to change.
• If there are stringent real-time requirements
that may not be met because of DBMS
overhead.
• If access to data by multiple users is not
required.
Disadvantages of DBMS
3. When no DBMS may suffice:
• If the database system is not able to handle
the complexity of data because of modeling
limitations
• If the database users need special
operations not supported by the DBMS.