Upload
rhenielou-cristobal
View
10
Download
0
Tags:
Embed Size (px)
DESCRIPTION
Database Management
Citation preview
Database Management System
Group 1
Flat-File Versus Database Environments
Computer processing involves two components: data and instructions (programs).
Conceptually, there are two methods for designing interface between programs and data: file-oriented (flat-file) processing: A specific data
file was created for each application [legacy systems]
data-oriented processing: Create a single data repository to support numerous applications [current systems]
Disadvantages of file-oriented processing include redundant data and programs and varying formats for storing the redundant data.
File-Oriented (Flat-File) Environment
Program 1
Program 2
Program 3
A,B,C
X,B,Y
L,B,M
User 2 (A/R)Transactions
User 1(Sales)Transactions
User 3 (Payroll)Transactions
Data
Where B is a customer record. Assume B’s address changes. Each userthat works with the B record must modify the address, increasing chance
for error.
Database Approach
Program 1
Program 2
Program 3
User 2 (A/R)Transactions
User 1 (Sales)Transactions
User 3 (Payroll)Transactions
Database
A,B,C,X,Y,L,M
With the database approach, any User could change B’s address - it would be
changed for all users. changes. [Assume all users have authority to change the
address for this example.]
DBMS
Data Redundancy & Flat-File ProblemsData Storage - creates excessive storage
costs of paper documents and/or magnetic form
Data Updating - any changes or additions must be performed multiple times (see example of B’s address)
Currency of Information - potential problem of failing to update all affected files
Task-Data Dependency - user’s inability to obtain additional information as his or her needs change
Data sharing/centralized database resolves flat-file problems:
No data redundancy - Data stored only once, eliminating data redundancy and reducing storage costs.
Single update - Because data are in only one place, requires only single update procedure, reducing time/cost of keeping database current.
Current values - Change to database made by any (authorized) user yields current data values for all other (authorized) users.
Task-data independence - As users’ information needs expand beyond immediate domain, new needs can be more easily satisfied than under flat-file approach
The Database Management System
Three conceptual mode Hierarchical Model Network Model Relational Model
Elements of Database Management System Users Database Management System
Data Definition Language Data Manipulation Language Query Language
Database Administrator
Database Management SystemFeatures: Program development Back up and recovery Database usage reporting Database access
Data Definition Language Internal view
Conceptual view (schema)
User view (sub schema)
DBMS Operation A user program sends a request for data
to DBMS. The DBMS analyzes the request by
matching the called data elements against the user view and the conceptual view.
The DBMS determines the data structure parameters from the internal view and passes them to the operating system, which performs the actual data retrieval.
Using the appropriate access method, the operating system interacts with the disk storage device to retrieve the data from the physical database.
The operating system then stores the data in a main memory buffer area managed by the DBMS.
The DBMS transfer the data to the user’s work location in main memory. At this point, the user’s program is free to access and manipulate the data.
When processing is complete. Steps 4, 5, and 6 are reversed to restore the processed data to the database.
Data Manipulation Language
Is the proprietary programming language that a particular database model uses to retrieve, process, and store data
Structured Query Language
SQL is a non-procedural language with many commands that allow users to input, retrieve, and modify data easily.
Basic commands:SELECT –get data from a database tableUPDATE – change data in a database tableDELETE – remove data from a database
tableINSERT INTO – insert new data in a
database table
Data Dictionary
Describes every data element in the database
This enables all users to share a common view of the data resource and greatly facilitates the analysis of user needs
Physical Database
is a representation of a data design which takes into account the facilities and constraints of a given database management system.
Relational Database Model
is a digital database whose organization is based on the relational model of data, as proposed by E.F. Codd in 1960. This model organizes data into one or more tables (or "relations") of rows and columns, with a unique key for each row.
Each row in a table has its own unique key, rows in a table can be linked to rows in other tables by storing the unique key of the row to which it should be linked (where such unique key is known as a "foreign key").
Relational Database Concepts
Entity, Occurrence, and Attributes
Entityanything about which the
organization wishes to capture data.
Two kinds of entity:PhysicalConceptual
Entity, Occurrence, and Attributes
Data Model- is the blueprint for ultimately creating the physical database.
Entity Relation (ER) Diagram- graphical representation used to depict the model.
Data Model using ER Diagram
Customer
Product
Payment
Sen
ds
Buys
Entity, Occurrence, and Attributes
Occurrence- is used to describe the number of instances or records that pertain to a specific entity.
Attributes- are the data elements that define an entity.
Associations and Cardinality
The labeled line connecting two entities in a data model describes the nature of the association between them.
Associations and Cardinality
Cardinality- is the degree of association between two entities.
4 basic forms:• 0, 1• 1,1• 0,M• 1,M
Cardinality Notation
Crow’s footWrite the cardinal values on
each end of the association line connecting the two entities
Physical Database TablesFour characteristics of properly designed tables:• The value of at least one attribute in each
occurrence must be unique, which is the primary key. Other attributes need not to be unique.
• All attribute values in any column must be of the same class.
• Each column in a given table must be uniquely named. However, different tables may contain columns with the same name.
• Tables must conform to the rules of normalization.
Linkages Between Relational Tables
Foreign keys- physically connect related tables to achieve the associations described in the data model.
Linkages Between Relational Tables
User Views- the set of data that a particular user sees.
Two types of views Two kinds of views:
- Digital - Simple - Physical - Complex
Anomalies, Structural Dependencies, and Data
Normalization
Database Anomalies
First Normal Form (1NF)Second Normal Form (2NF)Third Normal Form (3NF)
Three Types of Anomalies(anomalies are found in Unnormalized tables)
• Update Anomaly: Modification on attribute must be made in each of rows in which attribute appears.
• Insertion Anomaly: New item cannot be added to table until at least one entity uses particular attribute item.
• Deletion Anomaly: If attribute item used by only one entity is deleted, all information about that attribute item is lost.
• Anomalies can be corrected by creating relational tables.
The database anomalies described are symptoms of structural problems within tables called dependencies.
repeating groupspartial dependenciestransitive dependencies
Normalizing Tables
Normalization Process involves identifying and removing structural dependencies from tables under review.
Linking Normalized Tablesif 1:1 association, either of table’s
primary keys may be foreign key.if 1:M association, primary key of the
ONE side is embedded as foreign key in the MANY side.
if M:M (M:N) association, create separate linking table.
Accountants and Data Normalization
Accountants and Data Normalization
• Data Normalization – Technical matter– Responsibility of systems professionals
• Update anomaly – generate conflicting and obsolete database values
• Insertion anomaly – result in unrecorded transactions and incomplete audit trails
• Deletion anomaly – cause the loss of accounting records and the destruction of audit trails
Accountants and Data Normalization
• Accountants– Should have an understanding of
the process and be able to determine whether a table is properly normalized
DESIGNING RELATIONAL DATABASES
• “ View Modeling” – six phases of database design
1. Identify Entities2. Construct a data model showing entity
associations3. Add primary keys and attributes to the model4. Normalize the data model and add foreign
keys5. Construct the physical database6. Prepare the user views.
1. Identify Entities• To pass as valid entities, two
conditions need to be met:
1. An entity must consist two or more occurrences.
2. An entity must contribute at least one attribute that is not provided through other entities.
Purchasing system1. The purchasing agent reviews the inventory status
report for items that need to be reordered.
2. The agent selects a supplier and prepares online purchase order.
3. The agents prints a copy of the purchase order.
4. The supplier ships inventory to the company. Upon its arrival, the receiving clerk inspects the inventory and prepares an online receiving report. The computer system automatically updates the inventory records.
2. Construct a Data Model Showing Entity Associations
Determine the associations between entities and document them with and ER diagram.
Associations represent business rules.
2. Construct a Data Model Showing Entity Associations
Receiving Report
Purchase Order
Supplier
InventoryUpdates Contains
Sent to
Is associated
with
Supplies0,
M:M
M:M
0, M:M
1: 0, M
1: 1
Add Primary Keys and Attributes to the Model
Prepare the user viewsnormalize tables should support
all required views of system users
user views restrict users from have access to unauthorized data
Global View Integration• View Integration is combining
the data needs of all users into a single schema or enterprise-wide view.
Database in a Distributed Environment
• Centralized Databases- remote users send requests via
terminals for data to the central site, which processes the requests and transmits the data back to the user.
- the central site performs the functions of file manager that services the data needs of the remote users.
Data Currency in a DDP Environment
- During data processing, account balances pass through a state of temporary inconsistency, in which their values are incorrectly stated.
- To Illustrate, consider the computer logic for recording the credit sale of P2,000 to customer James
INSTRUCTION DATABASE VALUESAR-Jones AR-Control
START1. Read AR-Sub account (Jones) 1,5002. Read AR-Control account 10,0003. Write AR-Sub account (Jones) +2,000 3,5004. Write AR-Control account +2,000 12,000END
- To achieve data currency, simultaneous access to individual data elements by multiple sites needs to be prevented
- Software control (usually a function of the DBMS) that prevents multiple simultaneous accesses to data.
Data Lockup
Distributed Databases- It can be distributed using either partitioned
or replicated technique
• Partitioned Database- Splits the central database into segments or
partitions that are distributed to their primary users. The advantage of this approach are:
1. Storing data at local sites increases users’ control2. Permitting local access to data and reducing the
volume of data that must be transmitted between sites improves transaction processing response
time3. Reduce the potential for disaster
• Replicated Databases
- Effective in companies in which there exists a high degree of data sharing but no primary user.
- Data traffic between sites is reduced considerably
- Supports read-only queries
• Concurrency Control
- The presence of complete and accurate data at all remote sites.
- Systems designers need to employ methods that transactions processed at each site are accurately reflected in the databases at all other sites
Distinguishing features of Structured and
Relational databases