Chap4

2,014 views

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
2,014
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
14
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Chap4

  1. 1. Using Management Information Systems David Kroenke Database Processing Chapter 4
  2. 2. Learning Objectives <ul><li>Understand the purpose of database processing. </li></ul><ul><li>List the components of a database system. </li></ul><ul><li>Understand important database terms. </li></ul><ul><li>Know the elements of the entity-relationship model. </li></ul><ul><li>Understand the general nature of database design. </li></ul><ul><li>Recognize the need for and know the basic tasks of database administration . </li></ul>
  3. 3. Purpose of a Database <ul><li>The purpose of a database is to keep track of things that involve more than one theme. </li></ul>
  4. 4. Figure 4-1 A List of Student Grades
  5. 5. Figure 4-2 Student Data Shown in Form from Database
  6. 6. What Is a Database? <ul><li>A database is a self-describing collection of integrated records. </li></ul><ul><li>Attributes are grouped into columns , such as Student Number and Student Name. </li></ul><ul><ul><li>Columns are also called fields. </li></ul></ul><ul><li>Columns or fields, in turn, are grouped into rows , which are also called records. </li></ul><ul><ul><li>A grouping of records is called a Table </li></ul></ul><ul><li>A database is a collection of tables plus relationships among the rows in those tables, plus special data, called metadata. </li></ul><ul><ul><li>Metadata describes the structure of the database. </li></ul></ul>
  7. 7. Figure 4-3 Student Table (also called File)
  8. 8. Relationships Among Records <ul><li>A primary key is a unique column or group of columns that identifies an individual row in a table. </li></ul><ul><ul><li>Student Number is the primary key of the Student table. </li></ul></ul><ul><li>A foreign key is a non-key column or field in one table that links to a primary key in another table. </li></ul><ul><ul><li>Student Number in the Email and Office_Visit tables </li></ul></ul><ul><li>Relational databases store their data in the form of tables that represent relationships using foreign keys. </li></ul>
  9. 9. Figure 4-6 Examples of Relationships Among Rows
  10. 10. Metadata <ul><li>Databases are self-describing because they contain not only data, but also data about the data in the database </li></ul><ul><li>Metadata are data that describe data. </li></ul><ul><li>The format of metadata depends on the software product that is processing the database. </li></ul><ul><li>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. </li></ul>
  11. 11. Metadata (Continued) <ul><li>The presence of metadata makes databases much more useful. </li></ul><ul><li>Because of metadata, no one needs to guess, remember, or even record what is in the database. </li></ul><ul><li>Metadata make databases easy to use for both authorized and unauthorized purposes. </li></ul>
  12. 12. Figure 4-7 Example Metadata (in Access)
  13. 13. Components of a Database Application System <ul><li>By itself a database is not very useful. </li></ul><ul><li>Pure database data are correct, but in raw form they are not pertinent or useful. </li></ul><ul><li>Database applications make database data more accessible and useful. </li></ul>
  14. 14. Components of a Database Application System (Continued) <ul><li>Users employ a database application that consists of forms, formatted reports, queries, and application programs. </li></ul><ul><li>Each of these, in turn, calls on the database management system (DBMS) to process the database tables. </li></ul>
  15. 15. Figure 4-8 Components of a Database Application System
  16. 16. Database Management System <ul><li>A database management system (DBMS) is a program used to create, process, and administer a database. </li></ul><ul><li>Almost no organization develops its own DBMS. </li></ul><ul><li>Companies license DBMS products from vendors like IBM, Microsoft, Oracle, and others. </li></ul>
  17. 17. Database Management System (Continued) <ul><li>Popular DBMS products are: </li></ul><ul><ul><li>DB2 from IBM </li></ul></ul><ul><ul><li>Access and SQL Server from Microsoft </li></ul></ul><ul><ul><li>MySQL, an open-source DBMS product that is free for most applications </li></ul></ul><ul><li>The DBMS and the database are two different things: </li></ul><ul><ul><li>A DBMS is a software program. </li></ul></ul><ul><ul><li>A database is a collection of tables, relationships, and metadata. </li></ul></ul>
  18. 18. Creating the Database and Its Structures <ul><li>Database developers use the DBMS to create tables, relationships, and other structures in the database. </li></ul><ul><li>A form can be used to define a new table or to modify an existing one. </li></ul><ul><li>To create a new table, the database developer just fills out a new form. </li></ul><ul><li>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. </li></ul>
  19. 19. Figure 4-9 Adding a New Column to a Table (in Access)
  20. 20. Processing the Database <ul><li>The second function of the DBMS is to process the database. </li></ul><ul><li>Applications use the DBMS for four operations: read, insert, modify, or delete data. </li></ul><ul><ul><li>Also known as CRUD </li></ul></ul><ul><li>The applications call upon the DBMS in different ways: </li></ul><ul><ul><li>Via a form, when the user enters new or changed data </li></ul></ul><ul><ul><li>Via a computer program behind the form calls the DBMS to make the necessary database changes </li></ul></ul><ul><ul><li>Via an application program, the program calls the DBMS directly to make the change </li></ul></ul>
  21. 21. Processing the Database (Continued) <ul><li>Structured Query Language ( SQL ) is an international standard language for processing a database. </li></ul><ul><li>Most DBMS products accept and process SQL statements. </li></ul><ul><li>SQL can be used to create databases and database structures. </li></ul>
  22. 22. Administering the Databases <ul><li>A third DBMS function is to provide tools in the administration of the database. </li></ul><ul><li>Database administration involves a wide variety of activities. </li></ul><ul><ul><li>For example, the DBMS can be used to set up a security system involving user accounts, passwords, permissions, and limits for processing the database </li></ul></ul><ul><ul><li>DBMS administrative functions also include: </li></ul></ul><ul><ul><ul><li>Backing up database data </li></ul></ul></ul><ul><ul><ul><li>Adding structures to improve the performance of database applications </li></ul></ul></ul><ul><ul><ul><li>Removing data that are no longer wanted or needed, and similar tasks </li></ul></ul></ul>
  23. 23. Database Applications <ul><li>A database application is a collection of forms, reports, queries, and application programs that process a database. </li></ul><ul><li>A database may have one or more applications, and each application may have one or more users. </li></ul><ul><li>Applications have different purposes, features, and functions, but they all process the same inventory data stored in a common database. </li></ul>
  24. 24. Figure 4-10 Use of Multiple Database Applications
  25. 25. Forms, Reports, and Queries <ul><li>Data entry forms are used to read, insert, modify, and delete data. </li></ul><ul><li>Reports show data in a structured content. </li></ul><ul><ul><li>Some reports also compute values as they present the data. </li></ul></ul><ul><li>DBMS programs provide comprehensive and robust features for querying database data. </li></ul>
  26. 26. Figure 4-11 Example Student Report
  27. 27. Figure 4-12 Example Query
  28. 28. Database Application Programs <ul><li>Application programs process logic that is specific to a given business need. </li></ul><ul><li>Application programs can enable database processing over the Internet. </li></ul><ul><ul><li>For this use, the application program serves as an intermediary between the Web server and the DBMS. </li></ul></ul><ul><ul><li>The application program responds to events, such as when a user presses a submit button; it also reads; inserts; modifies; and deletes database data. </li></ul></ul>
  29. 29. Figure 4-13 Four Application Programs on Web Server Computer
  30. 30. Multi-User Processing <ul><li>Multi-user processing is common, but it does pose unique problems that you, as a future manager, should know about . </li></ul><ul><li>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. </li></ul><ul><ul><li>This problem is known as the lost-update problem , exemplifies one of the special characteristics of multi-user database processing. </li></ul></ul><ul><ul><li>To prevent this problem, some type of locking must be used to coordinate the activities of users who know nothing about one another. </li></ul></ul>
  31. 31. Multi-User Processing (Continued) <ul><li>Converting to a single-user database to a multi-user database requires more than simply connecting another computer. </li></ul><ul><li>The logic of the underlying application processing needs to be adjusted as well. </li></ul><ul><li>Be aware of possible data conflicts when you manage business activities that involve multi-user processing. </li></ul>
  32. 32. Enterprise DBMS Versus Personal DBMS <ul><li>DBMS products fall into two broad categories: Enterprise DBMS and Personal DBMS. </li></ul><ul><li>Enterprise DBMS </li></ul><ul><ul><li>These products process large organizational and workgroup databases. </li></ul></ul><ul><ul><li>These products support many users, perhaps thousands, of users and many different database applications. </li></ul></ul><ul><ul><li>Such DBMS products support 24/7 operations and can manage dozens of different magnetic disks with hundreds of gigabytes or more data. </li></ul></ul><ul><ul><li>IBM’s DB2, Microsoft’s SQL Server, and Oracle are examples of enterprise DBMS products. </li></ul></ul>
  33. 33. Enterprise DBMS Versus Personal DBMS (Continued) <ul><li>Personal DBMS </li></ul><ul><ul><li>These products are designed for smaller, simpler database applications. </li></ul></ul><ul><ul><li>Such products are used for personal or small workgroup applications that involve fewer than 100 users, and normally fewer than 15. </li></ul></ul><ul><ul><li>The great bulk of databases in this category have only a single user. </li></ul></ul>
  34. 34. Figure 4-14 Personal Database System
  35. 35. Developing a Database Application <ul><li>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. </li></ul><ul><li>Database structures can be extremely complex. </li></ul><ul><li>Before building the database, the developers construct a logical representation of database data called a data model. </li></ul><ul><ul><li>The data model describes the data and relationships that will be stored in the database. </li></ul></ul><ul><ul><li>The data model is referred to as a blueprint. </li></ul></ul>
  36. 36. Figure 4-15 Database Development Process
  37. 37. Entities <ul><li>An entity is something that the users want to track. </li></ul><ul><ul><li>Examples of entities are Order, Customer, Salesperson , and Item </li></ul></ul><ul><li>Some entities represent a physical object, such as an Item or Salesperson; others represent a logical construct of transaction, such as Order or Contact. </li></ul><ul><li>Entities have attributes that describe characteristics of the entity. </li></ul><ul><ul><li>Example attributes of Salesperson are SalespersonName, Email, Phone, and so forth </li></ul></ul>
  38. 38. Entities (Continued) <ul><li>Entities have an identifier , which is an attribute (or group of attributes) whose value is associated with one and only one entity instance. </li></ul><ul><ul><li>For example, OrderNumber is an identifier of Order , because only one Order instance has a given value of OrderNumber. </li></ul></ul><ul><ul><li>CustomerNumber is an identifier of Customer. </li></ul></ul><ul><ul><li>If each member of the sales staff has a unique name, then SalespersonName is an identifier of Salesperson. </li></ul></ul>
  39. 39. Figure 4-16 Student Data Model Entities
  40. 40. Relationships <ul><li>Entities have relationships to each other. </li></ul><ul><ul><li>An Order , for example, has an relationship to Customer entity and also to a Salesperson entity </li></ul></ul><ul><li>Database designers use diagrams called entity-relationship (E-R) diagrams . </li></ul><ul><li>All of the entities of one type are represented by a single rectangle. </li></ul><ul><li>A line is used to represent a relationship between two entities. </li></ul>
  41. 41. Relationships (Continued) <ul><li>If two entities have a plain straight line between them, then this type of relationship is called one-to-one. </li></ul><ul><li>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 . </li></ul>
  42. 42. Relationships (Continued) <ul><li>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. </li></ul><ul><li>The crow’s-foot notation shows the maximum number of entities that can be involved in a relationship. </li></ul><ul><ul><li>This is called the relationship’s maximum cardinality. </li></ul></ul><ul><ul><li>Common examples of maximum cardinality are 1:N, N:M, and 1:1. </li></ul></ul><ul><ul><li>Constraints on minimum requirements are called minimum cardinalities. </li></ul></ul>
  43. 43. Figure 4-17 Example of Department, Adviser, and Student Entities and Relationships
  44. 44. Figure 4-18 Example of Relationships-Version 1
  45. 45. Figure 4-20 Example Relationships Showing Minimum Cardinalities
  46. 46. Database Design <ul><li>Database design is the process of converting a data model into tables, relationships, and data constraints. </li></ul><ul><li>The database design team transforms entities into tables and expresses relationships by defining foreign keys. </li></ul>
  47. 47. Normalization <ul><li>Normalization is the process of converting poorly structured tables into two or more well-structured tables. </li></ul><ul><li>Data Integrity Problems </li></ul><ul><li>For example, suppose for a given table, the value for a defined attribute is changed correctly in two rows, but not in the third </li></ul><ul><ul><li>The table has what is called a data integrity problem: </li></ul></ul><ul><ul><ul><li>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. </li></ul></ul></ul><ul><ul><li>Data integrity problems are serious. </li></ul></ul>
  48. 48. Normalization (Continued) <ul><li>Data Integrity Problems (Continued) </li></ul><ul><ul><li>A table that has data integrity problems will produce incorrect and inconsistent information. </li></ul></ul><ul><ul><li>Users will lose confidence in the information, and the system will develop a poor reputation. </li></ul></ul><ul><ul><li>Information systems with poor reputations become serious burdens to the organizations that use them. </li></ul></ul>
  49. 49. Figure 4-21 A Poorly Designed Employee Table
  50. 50. Figure 4-21 A Poorly Designed Employee Table (Continued)
  51. 51. Normalization (Continued) <ul><li>Normalizing for Data Integrity </li></ul><ul><ul><li>The data integrity problem can occur if data are duplicated. </li></ul></ul><ul><ul><li>Because of this, one easy way to eliminate the problem is to eliminate the duplicated data. </li></ul></ul><ul><ul><li>This can be done by transforming the table into two tables. </li></ul></ul><ul><ul><li>Because such joining of tables is common, DBMS products have been programmed to perform it efficiently, but it still requires work. </li></ul></ul><ul><ul><li>Dealing with such trade-offs is an important consideration in database design. </li></ul></ul><ul><ul><li>The general goal of normalization is to construct tables such that every table has a single topic or theme. </li></ul></ul>
  52. 52. Normalization (Continued) <ul><li>Normalizing for Data Integrity (continued) </li></ul><ul><ul><li>Database practitioners classify tables into various normal forms according to the kinds of problems they have. </li></ul></ul><ul><ul><li>Transforming a table into a normal form to remove duplicated data and other problems is called normalizing the table. </li></ul></ul>
  53. 53. Figure 4-22 Two Normalized Tables
  54. 54. Figure 4-23 Transforming a Data Model into a Database Design
  55. 55. Figure 4-24 Representing a 1:N Relationship
  56. 56. Figure 4-24 Representing a 1:N Relationship (Continued)
  57. 57. Figure 4-25 Representing a N:M Relationship
  58. 58. Importance of User’s Review <ul><li>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. </li></ul><ul><li>The easiest time to change the database structure is during the data modeling stage. </li></ul><ul><li>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. </li></ul>
  59. 59. Importance of User’s Review (Continued) <ul><li>When a database is developed for your use, you must carefully review the data model. </li></ul><ul><li>If you do not understand any aspect of it, you should ask for clarification until you do. </li></ul><ul><li>The data model must accurately reflect your view of the business. </li></ul><ul><li>Do not proceed unless the data model is correct. </li></ul>
  60. 60. Summary <ul><li>The purpose of a database is to keep track of multiple themes that consist of multitudes of data. </li></ul><ul><li>A database is a self-describing collection of integrated records. </li></ul><ul><li>With the relational model, data are stored in tables and relationships are represented by column values. </li></ul><ul><li>A key, or table key, is a column or group of columns that uniquely identifies a row. </li></ul><ul><li>A foreign key is a column or group of columns in one table that identifies a row in a second table. </li></ul>
  61. 61. Summary (Continued) <ul><li>Metadata are data that describe data. </li></ul><ul><li>A database application system includes the database, the database management system (DBMS), and database applications. </li></ul><ul><li>The DBMS is a program used to create, process, and administer a database. </li></ul><ul><li>Structured Query Language (SQL) is an international standard for defining and processing database data. </li></ul><ul><li>A database application consists of forms, reports, queries, and application programs. </li></ul>
  62. 62. Summary (Continued) <ul><li>A data model is a logical representation of a database that describes data and relationships. </li></ul><ul><li>An entity is something that users want to track. </li></ul><ul><li>Entities have relationships to one another. </li></ul><ul><li>Database design is the process of converting a data model into tables, relationships, and data construction. </li></ul><ul><li>Normalization is the process of converting poorly structured tables into tables that are well structured. </li></ul>
  63. 63. Key Terms and Concepts <ul><li>Access </li></ul><ul><li>Attribute </li></ul><ul><li>Column </li></ul><ul><li>Crow’s foot </li></ul><ul><li>Crow’s-foot diagram version </li></ul><ul><li>Data integrity problem </li></ul><ul><li>Data model </li></ul><ul><li>Database </li></ul><ul><li>Database application system </li></ul>Database management system (DBMS) Entity Entity-relationship (E-R) data model Entity-relationship (E-R) diagram Field File
  64. 64. Key Terms and Concepts (Continued) Foreign key Form Identifier Lost-update problem Maximum cardinality Metadata Minimum cardinality Multi-user processing MySQL Object-relational database 1:N(one-to-many) relationship N:M (many-to-many) relationship Normal forms Normalization Oracle Primary Key Query Personal DBMS Record Relation Relational database Relationship Report
  65. 65. Key Terms and Concepts (Continued) Row SQL Server Structured Query Language (SQL) Table User account User role

×