Chap4

Preview:

DESCRIPTION

 

Citation preview

1

Using Management Information Systems

David Kroenke

Database Processing

Chapter 4

2

Learning Objectives

Understand the purpose of database processing.

List the components of a database system.

Understand important database terms.

Know the elements of the entity-relationship model.

Understand the general nature of database design.

Recognize the need for and know the basic tasks of database administration .

3

Purpose of a Database

The purpose of a database is to keep track of things that involve more than one theme.

4

Figure 4-1 A List of Student Grades

5

Figure 4-2 Student Data Shown in Form from Database

6

What Is a Database?

A database is a self-describing collection of integrated records.

Attributes are grouped into columns, such as Student Number and Student Name. Columns are also called fields.

Columns or fields, in turn, are grouped into rows, which are also called records. A grouping of records is called a Table

A database is a collection of tables plus relationships among the rows in those tables, plus special data, called metadata. Metadata describes the structure of the database.

7

Figure 4-3 Student Table (also called File)

8

Relationships Among Records

A primary key is a unique column or group of columns that identifies an individual row in a table. Student Number is the primary key of the Student table.

A foreign key is a non-key column or field in one table that links to a primary key in another table. Student Number in the Email and Office_Visit tables

Relational databases store their data in the form of tables that represent relationships using foreign keys.

9

Figure 4-6 Examples of Relationships Among Rows

10

Metadata

Databases are self-describing because they contain not only data, but also data about the data in the database

Metadata are data that describe data.

The format of metadata depends on the software product that is processing the database.

Field properties describe formats, a default value for Microsoft Access to supply when a new row is created, and the constraint that a value is required for the column.

11

Metadata (Continued)

The presence of metadata makes databases much more useful.

Because of metadata, no one needs to guess, remember, or even record what is in the database.

Metadata make databases easy to use for both authorized and unauthorized purposes.

12

Figure 4-7 Example Metadata (in Access)

13

Components of a Database Application System

By itself a database is not very useful.

Pure database data are correct, but in raw form they are not pertinent or useful.

Database applications make database data more accessible and useful.

14

Components of a Database Application System (Continued)

Users employ a database application that consists of forms, formatted reports, queries, and application programs.

Each of these, in turn, calls on the database management system (DBMS) to process the database tables.

15

Figure 4-8 Components of a Database Application System

16

Database Management System

A database management system (DBMS) is a program used to create, process, and administer a database.

Almost no organization develops its own DBMS.

Companies license DBMS products from vendors like IBM, Microsoft, Oracle, and others.

17

Database Management System (Continued)

Popular DBMS products are: DB2 from IBM Access and SQL Server from Microsoft MySQL, an open-source DBMS product that is free for

most applications

The DBMS and the database are two different things: A DBMS is a software program. A database is a collection of tables, relationships, and

metadata.

18

Creating the Database and Its Structures

Database developers use the DBMS to create tables, relationships, and other structures in the database.

A form can be used to define a new table or to modify an existing one.

To create a new table, the database developer just fills out a new form.

To modify an existing table say, to add a new column, the developer opens the metadata form for that table and adds a new row of metadata.

19

Figure 4-9 Adding a New Column to a Table (in Access)

20

Processing the Database

The second function of the DBMS is to process the database.

Applications use the DBMS for four operations: read, insert, modify, or delete data. Also known as CRUD

The applications call upon the DBMS in different ways: Via a form, when the user enters new or changed data Via a computer program behind the form calls the DBMS

to make the necessary database changes Via an application program, the program calls the DBMS

directly to make the change

21

Processing the Database (Continued)

Structured Query Language (SQL) is an international standard language for processing a database.

Most DBMS products accept and process SQL statements.

SQL can be used to create databases and database structures.

22

Administering the Databases

A third DBMS function is to provide tools in the administration of the database.

Database administration involves a wide variety of activities. For example, the DBMS can be used to set up a security

system involving user accounts, passwords, permissions, and limits for processing the database

DBMS administrative functions also include:Backing up database dataAdding structures to improve the performance of

database applicationsRemoving data that are no longer wanted or needed,

and similar tasks

23

Database Applications

A database application is a collection of forms, reports, queries, and application programs that process a database.

A database may have one or more applications, and each application may have one or more users.

Applications have different purposes, features, and functions, but they all process the same inventory data stored in a common database.

24

Figure 4-10 Use of Multiple Database Applications

25

Forms, Reports, and Queries

Data entry forms are used to read, insert, modify, and delete data.

Reports show data in a structured content. Some reports also compute values as they present the

data.

DBMS programs provide comprehensive and robust features for querying database data.

26

Figure 4-11 Example Student Report

27

Figure 4-12 Example Query

28

Database Application Programs

Application programs process logic that is specific to a given business need.

Application programs can enable database processing over the Internet. For this use, the application program serves as an

intermediary between the Web server and the DBMS. The application program responds to events, such as

when a user presses a submit button; it also reads; inserts; modifies; and deletes database data.

29

Figure 4-13 Four Application Programs on Web Server Computer

30

Multi-User Processing

Multi-user processing is common, but it does pose unique problems that you, as a future manager, should know about.When more than one user is trying to access a particular database table at same time, the first user to gain assess to the database table has the correct content value, the other users may not have the correct content value because the first user may modify the value without the other users knowing. This problem is known as the lost-update problem, exemplifies one

of the special characteristics of multi-user database processing. To prevent this problem, some type of locking must be used to

coordinate the activities of users who know nothing about one another.

31

Multi-User Processing (Continued)

Converting to a single-user database to a multi-user database requires more than simply connecting another computer.

The logic of the underlying application processing needs to be adjusted as well.

Be aware of possible data conflicts when you manage business activities that involve multi-user processing.

32

Enterprise DBMS Versus Personal DBMS

DBMS products fall into two broad categories: Enterprise DBMS and Personal DBMS.

Enterprise DBMS These products process large organizational and

workgroup databases. These products support many users, perhaps thousands,

of users and many different database applications. Such DBMS products support 24/7 operations and can

manage dozens of different magnetic disks with hundreds of gigabytes or more data.

IBM’s DB2, Microsoft’s SQL Server, and Oracle are examples of enterprise DBMS products.

33

Enterprise DBMS Versus Personal DBMS (Continued)

Personal DBMS These products are designed for smaller, simpler

database applications. Such products are used for personal or small workgroup

applications that involve fewer than 100 users, and normally fewer than 15.

The great bulk of databases in this category have only a single user.

34

Figure 4-14 Personal Database System

35

Developing a Database Application

The reason that user involvement is so important for database development is that the database design depends entirely on how users view their business environment.

Database structures can be extremely complex.

Before building the database, the developers construct a logical representation of database data called a data model. The data model describes the data and relationships

that will be stored in the database. The data model is referred to as a blueprint.

36

Figure 4-15 Database Development Process

37

Entities

An entity is something that the users want to track. Examples of entities are Order, Customer, Salesperson,

and Item

Some entities represent a physical object, such as an Item or Salesperson; others represent a logical construct of transaction, such as Order or Contact.

Entities have attributes that describe characteristics of the entity. Example attributes of Salesperson are

SalespersonName, Email, Phone, and so forth

38

Entities (Continued)

Entities have an identifier, which is an attribute (or group of attributes) whose value is associated with one and only one entity instance. For example, OrderNumber is an identifier of Order,

because only one Order instance has a given value of OrderNumber.

CustomerNumber is an identifier of Customer. If each member of the sales staff has a unique name,

then SalespersonName is an identifier of Salesperson.

39

Figure 4-16 Student Data Model Entities

40

Relationships

Entities have relationships to each other. An Order, for example, has an relationship to Customer

entity and also to a Salesperson entity

Database designers use diagrams called entity-relationship (E-R) diagrams.

All of the entities of one type are represented by a single rectangle.

A line is used to represent a relationship between two entities.

41

Relationships (Continued)

If two entities have a plain straight line between them, then this type of relationship is called one-to-one.

If two entities have a line between them, but at the end of one line in one of the two directions (left or right) exists an arrow (crow’s foot), then this type of relationship is called one-to-many.

42

Relationships (Continued)

If two entities have a line between them, but at the end of the line in both directions (left and right) exists an arrow (crow’s foot), then this type of relationship is called many-to-many.

The crow’s-foot notation shows the maximum number of entities that can be involved in a relationship. This is called the relationship’s maximum cardinality. Common examples of maximum cardinality are 1:N, N:M,

and 1:1. Constraints on minimum requirements are called

minimum cardinalities.

43

Figure 4-17 Example of Department, Adviser, and Student Entities and Relationships

44

Figure 4-18 Example of Relationships-Version 1

45

Figure 4-20 Example Relationships Showing Minimum Cardinalities

46

Database Design

Database design is the process of converting a data model into tables, relationships, and data constraints.

The database design team transforms entities into tables and expresses relationships by defining foreign keys.

47

Normalization

Normalization is the process of converting poorly structured tables into two or more well-structured tables.

Data Integrity ProblemsFor example, suppose for a given table, the value for a defined attribute is changed correctly in two rows, but not in the third The table has what is called a data integrity problem:

Some rows indicate that the name of the attribute is one value and another row indicates that the name of the value of the attribute is another. This is called multi-value.

Data integrity problems are serious.

48

Normalization (Continued)

Data Integrity Problems (Continued) A table that has data integrity problems will produce

incorrect and inconsistent information. Users will lose confidence in the information, and the

system will develop a poor reputation. Information systems with poor reputations become

serious burdens to the organizations that use them.

49

Figure 4-21 A Poorly Designed Employee Table

50

Figure 4-21 A Poorly Designed Employee Table(Continued)

51

Normalization (Continued)

Normalizing for Data Integrity The data integrity problem can occur if data are

duplicated. Because of this, one easy way to eliminate the problem is

to eliminate the duplicated data. This can be done by transforming the table into two

tables. Because such joining of tables is common, DBMS

products have been programmed to perform it efficiently, but it still requires work.

Dealing with such trade-offs is an important consideration in database design.

The general goal of normalization is to construct tables such that every table has a single topic or theme.

52

Normalization (Continued)

Normalizing for Data Integrity (continued) Database practitioners classify tables into various normal

forms according to the kinds of problems they have. Transforming a table into a normal form to remove

duplicated data and other problems is called normalizing the table.

53

Figure 4-22 Two Normalized Tables

54

Figure 4-23 Transforming a Data Model into a Database Design

55

Figure 4-24 Representing a 1:N Relationship

56

Figure 4-24 Representing a 1:N Relationship (Continued)

57

Figure 4-25 Representing a N:M Relationship

58

Importance of User’s Review

Users are the final judges as to what data the database should contain and how records in the database should be related to one another.

The easiest time to change the database structure is during the data modeling stage.

Once the database has been constructed, loaded with data, and application forms, reports, queries, and application programs created, changing a relationship means weeks of work.

59

Importance of User’s Review (Continued)

When a database is developed for your use, you must carefully review the data model.

If you do not understand any aspect of it, you should ask for clarification until you do.

The data model must accurately reflect your view of the business.

Do not proceed unless the data model is correct.

60

Summary

The purpose of a database is to keep track of multiple themes that consist of multitudes of data.A database is a self-describing collection of integrated records.With the relational model, data are stored in tables and relationships are represented by column values.A key, or table key, is a column or group of columns that uniquely identifies a row.A foreign key is a column or group of columns in one table that identifies a row in a second table.

61

Summary (Continued)

Metadata are data that describe data.A database application system includes the database, the database management system (DBMS), and database applications.The DBMS is a program used to create, process, and administer a database.Structured Query Language (SQL) is an international standard for defining and processing database data.A database application consists of forms, reports, queries, and application programs.

62

Summary (Continued)

A data model is a logical representation of a database that describes data and relationships.

An entity is something that users want to track.

Entities have relationships to one another.

Database design is the process of converting a data model into tables, relationships, and data construction.

Normalization is the process of converting poorly structured tables into tables that are well structured.

63

Key Terms and Concepts

Access

Attribute

Column

Crow’s foot

Crow’s-foot diagram version

Data integrity problem

Data model

Database

Database application system

Database management system (DBMS)

EntityEntity-relationship (E-R) data

modelEntity-relationship (E-R)

diagramFieldFile

64

Key Terms and Concepts (Continued)

Foreign keyFormIdentifierLost-update problemMaximum cardinalityMetadataMinimum cardinalityMulti-user processingMySQLObject-relational database1:N(one-to-many)

relationship

N:M (many-to-many) relationship

Normal formsNormalizationOraclePrimary KeyQueryPersonal DBMSRecordRelationRelational databaseRelationshipReport

65

Key Terms and Concepts (Continued)

RowSQL ServerStructured Query Language

(SQL)TableUser accountUser role