Chapter 4
Chapter 4
1.1 Data Management Data consists of raw facts such as employee numbers and sales figures 1.1.1 File Concepts Data are organized in a hierarchy o Bit (a binary digit) Represent the smallest piece of data a computer can process, on (1) or off (0)
o Field Field is typically a name, number, or combination of characters that describes an characteristic of a business object (e.g. employee no, position) or activity (e.g. sale no, sales amount)
o Record Collection of related data fields. E.g. Student number, student name
o File Collection of related records, E.g. employee file is a collection of all company employee record.
o Database Collection of integrated and related files. E.g. Student file, Exam File
Traditional Approach - Separate data files are created and stored for each application program
Student_File Traditional Approach Some data may be duplicated (require extra storage space) Difficult to access data from more
Stud_I First_Na Last_Na Addre Gend Contact_N D me me ss er o S001 S002 S003 Lim Wong Lau Mei Mei Hui Hui KL Perak Femal 012e 1234567 Femal 013e 1234569 Male 0144567890
Ming Wai KL
Exam_File Stud_I First_Na D me S001 S002 S003 Lim Wong Lau Last_Na Addre Gend Subje Contact_No Grade me ss er ct Mei Mei Hui Hui KL Perak Femal 012e 1234567 Femal 013e 1234569 Male 0144567890 BM BM BM A B C
Ming Wai KL
Stud_I First_Na Last_Na Addre Gend Contact_N Subje Grade D me me ss er o ct S001 S002 S003 Lim Wong Lau Mei Mei Hui Hui KL Perak Femal 012e 1234567 Femal 013e 1234569 Male 0144567890 BM BM BM A B C
Ming Wai KL
Common Field - to make a relationship
Subject BM
Grade A
Database Approach Reduced data redundancy (store only once) Reduce duplicates & inconsistencies in updating Page 2
1.2.1 The Relational Database Model Based on the concept of two-dimensional tables, called relations. Stores data in tables that consist of rows and columns.
Each row of a table represents a data entity/ tuple Each Columns of the table represent attributes Domain - values can be placed in each column of the relational table Primary key - field or set of fields that uniquely identifies the record. E.g. Customer No.
1.3 Types of Data Files : Master file & Transaction Files Master file
o
Data file containing relatively permanent records that are generally updated periodically.
Page 3
Chapter 4
Inventory_shoe (Master File) Item_N Item_Descripti Unit_cos Unit_pric Quantit o on t e y A001 A002 Adidas New Balance RM120 RM100 RM160 RM120 10 20
Transaction file
o
Temporary holding file that holds all changes to be made to the master file.
Inventory_shoe (Transaction File) Stock In 10 20
Stock Out 5 8
to the master file (remains with the system only until the transactions are processed) Data about transactions (replace with other transactions 1.4 data for new transactions) Database Management Systems (DBMSs)
A DBMS is a set of programs that provide users with tools to add, delete, access, and analyze data stored in one location.
A repository contains data about each file in the database and each field within those files.
Chapter 4
Page 4
2.
3.
Data Security
To specify different access privileges for different users of a DBMS. Access privileges: Actions that can be performed by specific users. To ensure that only authorized users access data at permitted times.
4. Backup and Recovery Backup - Copy the entire database into other storage media. Recovery - Restore a database when it becomes damaged or destroyed. Advantages of using DBMS 1. Reduced data redundancy
Data is organized by the DBMS and stored only once , reduce duplicate data
2.
Improved data integrity Ensures no separate files contain copies of the same piece of data. Reduce duplicates & inconsistencies in updating
3.
Better & easier access to data and information Easy to access and retrieve data from a database, using simple commands
Chapter 4
Page 5
4. Shared data
Chapter 4
Page 6