The document discusses database management, highlighting the transition from manual data management to computer-based systems, specifically file-based and database approaches. It explains the advantages of using a database management system (DBMS), including data independence, sharing, and security. Additionally, it covers basic concepts in data modeling, relationships between entities, and practical steps for creating and managing databases using Microsoft Access.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
11 views28 pages
Unit Three IT G11
The document discusses database management, highlighting the transition from manual data management to computer-based systems, specifically file-based and database approaches. It explains the advantages of using a database management system (DBMS), including data independence, sharing, and security. Additionally, it covers basic concepts in data modeling, relationships between entities, and practical steps for creating and managing databases using Microsoft Access.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 28
UNIT 3
DATABASE MANAGEMENT Database management is a method used to organize data in a more effective way for easy management and use of data.
Data Management Approaches
Data management is an integral part of our daily lives. 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. The first computer-based data management is a file-based data management approach. 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. 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 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. 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. It stores all organization’s data in one repository. A database is created to address the data requirements of different user groups and application programs in an organization. Data in the database are used to generate different information that are used in the daily business activities. 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. 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. Then, the DBMS retrieves data that matches the queries and replies retrieved data to the application programs. 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. • 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. 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 specifies what data to store in the database. For example, a school database stores data about students and teachers. It does not need to store data about patients or traffic accidents. Basic Concepts in Data Modelling The basic concepts of entity, relationship and attribute are discussed below: • 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. Similarly, a library may have entities like book, loan and borrower. 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. 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 Cont… 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 . 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. One-to-many relation An instance in one entity is associated with many instances in the other related entity (see Figure 3.8). For example, a department called ‘Computer Science’ is associated with multiple students. 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.
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. 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 are 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. Relational Data Model The relational data model represents data in terms of two- dimensional tables called relations. A relation is nothing but a table of rows and columns. Each row, also called a record or tuple, contains a unique instance of data. These rows in the relation denote a real-world entity. The columns in a relation, also known as attributes or fields, are used to describe the properties of relations. Cont… The relational data model provides conceptual tools to represent a data model of a relational database. A relational data model captures a collection of relations, their attributes, and their relationships. Relational database Relational database is a type of database that contains logically related set of tables. The rows in a table are called records, and the columns are called fields or attributes. Relational database is implemented using relational database management system (RDMS) software. Cont… Cont… Creating Relational Database in Microsoft Acces This section explains how to create and manage a database on Microsoft (MS) Access. Relations or entities are represented as database tables. Attributes are represented as table fields. The data type column indicates the type of data to be stored for the respective field. Creating Microsoft Access Database When you work on Microsoft Access, creating a database is the first step. In MS Access, a database is a container of database objects such as tables, forms, queries and reports. There are different versions of MS Access software to create and manage databases. In this textbook, you will learn how to create and manage database objects using MS Access 2010. In order to create a database, follow the following steps: 1. Open MS Access Software 2. In the main Window, click on Blank database 3. Enter the database name in the File Name input box. (When giving a name to the database, it is highly recommended to use names that properly describe the data stored in the database.) 4. Click on the Create button. Cont… After the database is created, another MS Access window is opened where database objects can be created. Before other database objects are created, a table object must be created. A table is a set of fields that store data about a certain entity. Creating Table in Microsoft Access When you create a new table, Microsoft Access asks you to define table fields. Table fields are entity attributes. One or more tables can be created in one database. Each table name must be unique. The tables must also have two or more fields. Field names must be unique in a table. Follow the following steps to create a table in MS Access: 1. Open a database file. 2. Click on Table Design button from the Create menu. 3. Enter field names for the new table such as Student ID, Sname, Sex, Age and Grade_level (see Figure 3.15). 4. Specify the data type of the field. The data type can be text, number, date/ time, currency, etc. depending on the type of data that the field is used to store. 5. When you finish, click on the Save button. 6. In the popup that is displayed, enter the table name and click on the Ok button. Cont… Follow the following steps in order to enter data into a database table: 1. Open a database if it is not already opened 2. Click on the table name and select Datasheet View from View in the toolbar. For example, open student table. 3. Enter appropriate values for each field. 4. Enter all the records of the Student table Creating Query in Microsoft Access Query is a database object that provides a custom view of data from one or more tables. It is a way of searching for and compiling data from one or more tables. In MS Access, data is retrieved through query by creating graphical query or writing Structured Query Language (SQL) statements. In this section, you will learn how to retrieve data using graphical query. A query is used to define specific search conditions to find exactly the data you want. Cont… Follow the following steps in order to create a query in Microsoft Access: 1. Open a database where your database tables are stored 2. 2. Click on Create menu button. Then, you get the following MS Access toolbar Cont… You can create query using Query Wizard or Query Design. Let us see how to create a query using Query Design option. 3. Click on Query Design button from Microsoft Access toolbar. 4. Select a table or tables from Show Table box from which you want to select records for your query (See Figure 3.18), and click on OK bottom. Cont… 5. Select the fields in the Field row. For example, if you want to select only sname and sex field, select sname in the first column and sex in the second column of the Field row. 6. Select Datasheet View from the toolbar to see your query results (see Figure 3.19).If you do it correctly, you get the following results. Adding Criteria to Query Design By adding additional criteria to a query design, it is possible to retrieve specific data from a table. Follow the following steps in order to add criteria to a query. 1. Open the Query Design Window. 2. Add a table to query design window. 3. Select fields to be displayed in Query Result Window. 4. In the Criteria row, enter query selection criteria. For example, if you want to display only Male students, under Sex column, enter M as your query selection criteria (See Figure 3.20). Selecting Data from Multiple Tables The power of a relational database is that it allows you to retrieve data from two or more tables. Follow the following steps in order to select data from multiple tables: 1. Open the Query Design window. 2. Add a table to the Query Design window. If Show Table window is not displayed, click on Show Table button from the Toolbar. You will have a list of tables in the Show Table Box. 3. Select a table and click on Add button to add the table into Query Design Window. 4. Repeat step 3 to add more tables. 5. Establish a relationship between the tables by dragging the primary key field in the Parent table to the Child Table (See Figure 3.21). Cont…
6. Select the fields to be displayed in Query Datasheet View. For example, we
want to select student name (fname) from student table, subject and grade from grade table, and teacher name (tname) from teacher table. 7. Choose the Save button from the File menu to save your query. 8. Enter a file name for the new Query, and click on the OK button. 9. Click on the View button in the Toolbar to see the query results (see Figure 3.22). ou k Y an 3 h I T T U N O F N D E