Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
128 views

Instructor's Notes: Database Management Systems 3 Edition, by Gerald Post

This document provides instructor notes on teaching database systems and design. It begins with an introduction to database management systems and their key components. It then discusses database design, including identifying business objects and their relationships through entity-relationship diagrams and class diagrams. Finally, it covers some important database design concepts like normalization, primary keys, associations, and data types. The overall document provides an overview of important concepts to cover in teaching database systems and design.

Uploaded by

Aarthi Devpal
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
128 views

Instructor's Notes: Database Management Systems 3 Edition, by Gerald Post

This document provides instructor notes on teaching database systems and design. It begins with an introduction to database management systems and their key components. It then discusses database design, including identifying business objects and their relationships through entity-relationship diagrams and class diagrams. Finally, it covers some important database design concepts like normalization, primary keys, associations, and data types. The overall document provides an overview of important concepts to cover in teaching database systems and design.

Uploaded by

Aarthi Devpal
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 15

Instructors Notes

Database Systems Database Management Systems 3rd Edition, by Gerald Post

Dr. Karl Knapp Revised 1/16/2007

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.

Databases and Application Development


Tell key is the design phase Standard steps in the systems development methodology: 1. Feasibility identify scope, costs and schedule 2. Analysis gather information from users 3. Design ** define tables, relationships, forms and reports 4. Development create forms, reports and help; test 5. Implementation transfer data, install, train, review

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

Tell can use Access as a forms generator for Oracle data

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.

Advantages of the DBMS Approach


Tell The DBMS stores data efficiently The DBMS maintains data consistency by enforcing business rules (price is always greater than zero) The DBMS makes it easy to integrate data Developers focus first on the data

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).

Leading Commercial Databases


Tell DB2, Oracle, SQL Server, Access (lower end), MySQL

History of Database Management Systems


Tell The hierarchical database approach begins by claiming that business data often exhibits a hierarchical
Page 3 of 15

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.

Focus is on this approach

Introduce Microsoft Access & Homework

Subject

Page 4 of 15

Teaching Notes
Teaching notes Tell

Ch 2 Database Design Introduction


A model is a simplified abstraction of a real-world system. Three common types of models are used to design systems: Process models Class (or object) models Event models

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

Methods (optional for databases)

Tables and Relationships


Tables represent the business classes, where the properties become columns in the table, and each row represents data for one of the objects. Classes, which eventually become tables, are related to each other. In a class diagram, this relationship is shown by a line connecting the two classes. These relationships have a numerical value as well that contains additional business information. (one to one or one to many).

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

Associations and Relationships


Associations and relationships represent business rules. Associations can be named: UML refers to the association role. Each end can be labeled. UML uses numbers and asterisks to indicate the multiplicity in an association. The asterisk (*) represents many.

Customer

Sale

Class Diagram Details


A class diagram is a visual model of the classes and associations in an organization. Many times a
Subject Page 7 of 15

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

Data Types (Domains)


See page 49 for data types on different systems. Text (text, memo) Number (integer, long, long, double, currency, binary) Date/Time Image (OLE Object) Autonumber

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)

Triggers can be used to initiate events when certain conditions occur.

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

Chapter 3 Data Normalization Tables, Classes and Keys


Composite Keys
A composite key is a primary key that uses more than one column as part of the primary key. A foreign key is a field in a table which is a primary key in another table. A surrogate key is a unique key (usually generated by the DBMS) which identifies each record. (Access uses Autonumber).

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.

First Normal Form


When a table has no repeating groups, it is said to be in first normal form (1NF). The first normalization rule is clear: if a group of items repeats, it should be split in to a new table. Example: Video rental table on page 87 repeated data for each customer, what happens if you delete an entry (lost customer data), duplication. Make sure that when you split a table, the new tables key is part of the other tables fields (so that you can refer to it).

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.

Second Normal Form


The table is in second normal form (2NF) if every nonkey column depends on the entire key (not just part of it). Note that this issue arrives only for composite keys (with multiple columns). Example: where do you put the rental rate for a movie? Video table or the VideosRented table? What are the issues that arise here? Should price be stored both places?

Third Normal Form


The table is in third normal form (3NF) if every non-key column depends on nothing but the key.

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.

Converting a Class Diagram to Normalized Tables


One to Many Relationships
The most important rule in converting class diagrams to normalized tables is that relationships are handled by placing a common column in each of the related tables.

Many to Many Relationships


In relational databases many to many relationships must be split in to two one-to-many relationships to get to beyond third normal form (BCNF). Example is purchase order and item tables. Need a PO/Item table that joins the two.

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.

Data Volume and Usage


You must also estimate the size of the resulting designed database. These values let you estimate the hardware and software costs for the database. Begin with the list of normalized tables. The process consists of estimating the average number of types in each row of the table and then estimating the number of rows in the table, then add the table sizes to estimate the total database size. This number represents the minimum size of the database. The next step is to estimate the length of time the data will be stored. Databases also reserve space for indexes, log files, forms, programs and backup data.

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?

Chapter 4 Data Queries Three Tasks of a Query Language


To create and build databases you need to perform three basic sets of tasks (1) define the database, (2) change the data, and (3) retrieve data. Some systems use formal terms to describe these categories. Commands, grouped as Data Definition Language (DDL) are used to define the data tables and other features of the database. The common DDL commands include ALTER, CREATE and DROP. Commands used to modify the data are classified as Data Manipulation Language (DML). Common DML commands are DELETE, INSERT and UPDATE. The SELECT command is used to retrieve data; it is the most complex SQL command.

Four Questions to Retrieve Data


1. What output do you want to see? 2. What do you already know (or what constraints are given)? 3. What tables are involved? 4. How are the tables joined?

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?

Chapter Title Section Title


Section text

Subject

Page 15 of 15

You might also like