DATABASE MANAGEMENT UNIT 3:- DATABASE MANAGEMENT Learning Outcomes • At the end of this unit, students will be able to: • Define database • Explain data models • Describe data management approaches • Recognize database entities, attributes and relationships • Develop data models with Entity Relationship Diagram (ERD) • Create and manage databases using Microsoft Access UNIT 3 DATABASE MANAGEMENT
Database management is a method
used to organize data or database files in a more effective way for easy management and use of data. 3.1. Data Management Approaches • Data management is the practice of collecting, keeping, and using data securely, efficiently, and cost-effectively. • Data management is an integral part of our daily lives. Cont. • Traditionally, data used to be managed manually using physical papers. • As the size of data that organizations manage become larger and larger, computers have become instrumental for efficient management of data. Cont. • The first computer-based data management is a file-based data management approach. • The database approach was introduced later and addressed the inherent weaknesses of the file-based approach. If u have any question? Enough for to day. 23/4/2016 E.C 3.1.1 File based data management • File-based data management is an approach in which data is stored in separate files without explicit relationships. • Data in different files is managed by different application programs. • Any change to data requires modification of the program that uses the data. Cont… • Changes made on the program may also require change in the file structure. • In file-based data management approach, each department creates and processes its own files separately. • For example, procurement and finance departments create and manage their own files. Cont. Cont. • The file-based data management approach creates problems of data duplication and data inconsistency. For example, let us say employee data is stored both in human resource and finance departments. • When human resource department modifies the employee records upon hiring new employees, it may not communicate the information to the finance department. Cont. This Photo by Unknown Author is licensed under CC BY-NC-ND 24/04/2016 E.C 3.1.2 Database approach to data management • In the database approach to data management, data is managed by a database using a database management system (DBMS) software. • A database is a collection of logically-related data or an organized collection of structured information, or data, typically stored electronically in a computer system. • It stores all organization’s data in one repository. Cont… • A database is usually controlled by a database management system (DBMS). • It is used to maintain internal records of organizations such as student records for schools, customer records and daily sales records for supermarkets, patient database for hospitals and the like. Cont. Cont… • DBMS is software that manages databases. • DBMS is used to add new data, modify data and delete data in the database. It is also used to retrieve data from the database. • DBMS essentially serves as an interface between the database and end users or application programs. It ensures that data is easily accessed by potential users. 06/05/2016 E.C Cont. • The database management process has three main components. At the bottom is the database which stores the actual data. In the middle is a DBMS which manages the database. At the top of the DBMS are application programs that use the database. The application programs submit database query to the DBMS. Cont. The database approach to data management provides many advantages to the organization. Some of the advantages are:
• Data independence: A database is created to
store all organization data and support all users of the organization. Each user or department does not need to manage its own isolated data. • Data sharing: all organization’s data is stored in one central database. DBMS allows this central database to be accessed by different users. The database approach to data management provides many advantages to the organization. Some of the advantages are: • Avoiding data redundancy: Isolated departmental files are stored in one central database. The DBMS can retrieve data from multiple tables so as to meet the requirement of different database users or application programs. • Improved data security: Data in the database is accessed only by authorized users. Only users who are given data access right can access and modify data in the database. 06/05/2016 E.C 3.2. Data Model Data model of a database is the blue print of the database. It is used as a guide to store data in a database. It shows database entities, attributes and the relationships between the entities. It also that organizes elements of data and standardizes how they relate to one another and to the properties of real-world. For example, a school database stores data about students and teachers. It does not need to store data about patients or traffic accidents. 3.2.1 Basic Concepts in Data Modelling • Entities:- An entity is an object that exists. • Entities are basically people, places or events about which you want to store data. For example, banks may keep data about customers and bank account entities. Entities are equivalent to tables when implemented in the database. • Attributes are properties of an entity that are used to differentiate one entity from other entity. For example, customer entity may have customer id, name, sex and address as its attributes. On the other hand, book entity may have author name, book title and publication year as its attributes. 07/05/2016 E.C Cont…. The two entities have different attributes because they are different entities. • A relationship is an association between entities. For example, customer has account in a bank. The verb ‘has’ indicates the relationship between customer and bank account entities. The relationship between entities can take different forms: • One-to-one relationship: An instance of an entity has only one instance in the other entity with which it is associated (see Figure 3.8). For example, a country and a capital city. A country is associated with one capital city, and a capital city is associated with only one country. Figure 3.8: One-to-many relationship type • Many-to-many relationship: Instances on both sides of the relationship are associated with multiple instances of the other entity (see Figure 3.9). For example, an employee may work in multiple projects. At the same time, a project may have multiple employees assigned to it.
Figure 3.9: Many-to-many relationship type
3.2.2 Entity Relationship Diagram
• One of the popular representation tools for data
model is Entity Relationship Diagram (ERD). ERD is used to visually represent a data model. It has three main components discussed in Section 3.2.1, namely entity, attribute and relationship. Entities are represented as a rectangle and relationships as a line to show the association between entities. Attributes are represented as ellipses. The names of entities and attributes are placed inside the rectangle and the ellipse respectively. The names of relationships, on the other hand, are placed right on top of the line. • Figure 3.10 shows an example of ERD that shows the association between a student and book entities and their respective attributes.
Figure 3.10 Entity Relationship Diagram
• As Figure 3.10 shows, student entity has student_id, name, age and address attributes. On the other hand, book entity has book_id, book_title, publication_year attributes. The two entities are related by ‘borrows’ relationship.