Instructor's Notes: Database Management Systems 3 Edition, by Gerald Post
Instructor's Notes: Database Management Systems 3 Edition, by Gerald Post
Subject
Page 1 of 15
Teaching Notes
Teaching notes Ask Why does Kroger offer a customer card for savings? What do they do with the data? Are you comfortable with the data you give up? Is giving up your privacy worth the few dollars you save? Tell databases all around us, and basics to right.
Ch 1 - Introduction Introduction
A database is a collection of data stored in a standardized format designed to be shared by multiple users. A database management system (DBMS) is software that defines a database, stores the data, supports a query language, produces reports, and creates data entry screens.
Components of a DBMS
Tell Ask what is a business rule? The database engine is the heart of the DBMS. It is responsible for storing, retrieving and updating the data. The other components rely on the engine to store not only the application data but also the internal system data that defines how the application will operate. The database engine is also responsible for enforcing the business rules regarding the data. The data dictionary holds the definitions of all of the data tables. It describes the type of data that is being stored, allows the DBMS to keep track of the data, and helps developers and users find the data they need. Tell can use Access as a report writer to Oracle data The query processor enables developers and users to store and retrieve data. Queries are derived from business questions. The report writer enables you to set up the report on
Subject
Page 2 of 15
the screen to specify how items will be displayed or calculated. Most of these tasks are performed by dragging data onto the screen. The report writer can be integrated into the DBMS or a stand-alone application. Data Database engine Data Dictionary Query Processor Reports The forms generator helps the developer create input forms. The forms generator enables developers to build forms by dragging and dropping items on the screen. Data Database engine Data Dictionary Query Processor Forms A good DBMS also contains an application generator which consists of tools that assist the developer in creating a complete application package. DBMS systems provide support for traditional 3GL languages as well (e.g. Visual Basic, COBOL, ). DBMS systems also provide support for communication and integration utilities for Internet enabled applications and application integration. Security utilities and functions are also a key part of a DBMS.
Tell Ask if you add a new field to a system, what do you need to do?
Data Independence
Separation of the data definition from the program is called data independence. This enables you to change the data definition without altering the program. Data independence is critically important for Internetenabled applications because the business rules must be implemented at the database level (or should be).
Subject
relationship. Think of this approach like filing cabinets and file folders. Drawer for each customer, folder for each order, order slips in each folder. Fast for viewing data from the top down, but hard to answer management questions across the middle or bottom of the data. The network database model attempted to solve the hierarchical problem of searching for data from different perspectives. Connecting arrows indicate linkages between the data. These linkages are maintained as individual indices that duplicates every key data item in the associated data set. Designers must anticipate every business question beforehand (major problem). Also inefficient. The relational database approach has tables which each store attributes in columns that describe specific data entities. The connections between tables exist through matching data stored on each table. The strength of this approach is that designers do not need to anticipate every question that might be asked. An object-oriented (OO) database defines objects that can be reused in many programs. The properties describe the object, the methods are short programs that define the actions the object can take.
Subject
Page 4 of 15
Teaching Notes
Teaching notes Tell
Getting Started
Initial steps in database design: 1. Identify the exact goals of the system 2. Talk with the users to identify the basic forms and reports 3. Identify the data items to be stored 4. Design the classes (tables) and relationships 5. Identify any business constraints 6. Verify the design matches the business rules
Designing Databases
Identifying User Requirements
You must thoroughly understand the business needs before you can create a useful system. A key step is to interview users and observe the operations of the firm. One of the most important tasks in designing a database application is to correctly identify the data that needs to be stored. You need to gather the following information about the data: 1. The data that needs to be collected 2. The data type (domain) 3. The amount of data involved
Business Objects
An entity is some item in the real world that you wish to track. That entity is described by its attributes and properties. In modeling terms, an entity listed with its properties is called a class. In a programming
Subject
Page 5 of 15
environment, a class can also have methods or functions that it can perform, and these can be listed with the class. A class diagram displays each class as a box containing the list of properties for the class. Class diagrams also show how the classes are related to each other by connecting them with lines. Class Name (e.g. Customer) CustomerID LastName FirstName Phone Address City State Zip Add Customer Delete Customer
Name
Properties
Definitions
A relational database is a collection of related tables. A table is a collection of columns (attributes or properties) that describe an entity. Individual objects are stored as rows within the table. Two important aspects to a relational database are that: 1. All data must be stored in tables 2. All tables must be carefully defined to provide flexibility and minimize problems. Data normalization is the process of defining tables properly to provide flexibility, minimize redundancy, and ensure data integrity.
Subject
Page 6 of 15
Primary Key The primary key is a column or set of columns that uniquely identifies a particular row. The most important issue with a primary key is that it can never point to more than one row or object in the database.
Class Diagrams
Term Entity Definition Something in the real world that you wish to describe or track Description of an entity that includes its attributes (properties) and behavior (methods) One instance of a class with specific data A characteristic or descriptor of a class or entity A function that is performed by the class A relationship between two or more classes Pet Store Examples Customer, merchandise, sales Customer, merchandise, sale
Class
Object
Joe Jones, Premium Cat Food, Sale #32 LastName, Description, SaleDate AddCustomer, UpdateInventory , ComputeTotal Each sale can have only one customer
Property
Method
Associatio n
Customer
Sale
relationship requires both of the entities to exist. There is a referential relationship between the order and the customer entities. Business rules require that customer data must already exist before that customer can make a purchase. This relationship can be denoted by specifying the minimum value of the relationship (0 if it is optional, 1 if it is required).
Customer
11
0*
Sale
Events
Three basic events in a database environment: Business events that trigger some function (sale reduce inventory) Data changes that signal some alert (inventory level order) User interface events that trigger some action (click)
Large Projects
Why are large projects harder? Communication with multiple users Communication between IT workers Need to divide project into pieces for teams Finding data Staff turnover Documentation
Subject
Page 8 of 15
Subject
Page 9 of 15
Teaching Notes
Teaching notes Tell
Example p 87 video rental example. Video rental transactions with all of the data in one table. Solution is to split the transaction and video tables to remove duplicate data.
Example p 91 video rental transaction table the problem is that the title depends only on the VideoID and no on the TransID. P 92 dependencies of the fields Split the items that depend on only part of the key are moved to a separate table. Both tables must have VideoID (p93). Example customer info problems when stored in the transactions table. (p95). Solution p 97.
Subject
Page 10 of 15
Skip 4th Normal Form and Other NFs Data Rules and Integrity
Data integrity constraints are the business rules that must be followed and applied to the data. Enables consistent data. Referential integrity exists when a value for a foreign key can be entered only if the corresponding value already exists in the originating table. Most relational databases also support cascading delete, which uses the same concepts of a user deletes a row in the Customer table, you may also want to delete the related entries in the Rentals table.
Generalization or Subtypes
An item is a generic description of something that is purchased. Every item has a description and a list price. However, the company deals with three types of items: raw materials, assembled components, and office supplies. Each of these subtypes has some additional properties that you wish to track. In converting this design to a relational database, there are two basic approaches: (1) If the subtypes are similar, you could ignore the subclasses and compress all the subclasses into the main class that would contain every property for all of the subclasses. In this case, every item entry would have several null values. (2) in most cases a better approach is to create separate tables for each subclass. Each table will contain the primary key from the main item class. (p110).
Composition
Subject Page 11 of 15
Bicycle example in which a bicycle is built from various components. You can solve the main composition problem by creating properties in the main Bicycle table for each of the component items (WheelID, CrankID, StemID,).
Reflexive Associations
Occasionally, an entity may be linked to itself. A common example is employees and managers (managers are employees). You can add a manager column to the employee table which stores the manager ID. How would you handle situations where an employee has more than one manager? The solution is to create a new table that lists EmployeeID and ManagerID which are both part of the primary key.
Data Dictionary
A data dictionary or data repository consists of metadata data that describes the data stored in the database. The table definition system allows the entry of this metadata. You can also set default values for each column to speed up data entry.
Subject
Page 12 of 15
Teaching Notes
Teaching notes Tell - Discussion rules dont name your company in discussion groups (could be a former firm) Ask is your (current or past) company nimble? Customer focused? Efficient? Product quality goods and services?
Subject
Page 13 of 15
Teaching Notes
Teaching notes Tell - Discussion rules dont name your company in discussion groups (could be a former firm) Ask is your (current or past) company nimble? Customer focused? Efficient? Product quality goods and services?
Chapter 8 Data Warehouses and Data Mining Data Warehouses and Online Analytical Processing
A data warehouse holds a copy of the transaction data in a special database that is dedicated to answering managerial questions.
Subject
Page 14 of 15
Teaching Notes
Teaching notes Tell - Discussion rules dont name your company in discussion groups (could be a former firm) Ask is your (current or past) company nimble? Customer focused? Efficient? Product quality goods and services?
Subject
Page 15 of 15