Database Management System1(2)

Published on January 2017 | Categories: Documents | Downloads: 29 | Comments: 0 | Views: 158
of 11
Download PDF   Embed   Report

Comments

Content

Database Management Systems - Prof. Holowczak

Zicklin School of Business - Baruch College City University of New York

Database Management Systems Introduction
What You'll Learn This Week
• • • • • •

• • • • •

Introduction to the course Introduction to Databases File Systems Example Database Brief History of Database Systems Contents of a Database o User Data o Metadata o Indexes o Applications Metadata Data Modeling and Database Design The Database Development Process Designing A Database - A Brief Example Introduction to the Internet and WWW For Next Week

Introduction to the course
• • •

Syllabus Computer Labs and Software Course Logistics

Introduction to Databases
Pratt/Adamski Chapter 1
• •

Elmasri/Navathe (3rd ed.) Chapters 1 and 2

Kroenke Book (7th ed.) Chapters 1 and 2

McFadden (5th ed.) Chapter 1

Mata-Toledo / Cushman Schaum's Outlines Ch. 1

Q: What is a Database ? Answer from Pratt/Adamski:









A Database (DB) is structure that can store information about: 1. multiple types of entities, 2. the attributes that describe those entities; and 3. the relationships among the entities Answer from Elmasri/Navathe: o A Database (DB) is collection of related data - with the following properties: 1. A DB is logically coherent and has some relevant meaning 2. A DB is designed, built and populated with data for a specific purpose 3. A DB represents some aspect of the real world. Answer from Kroenke: An integrated, self-describing collection of related data o Integrated: Data is stored in a uniform way, typically all in one place (a single physical computer for example) o Self-Describing: A database maintains a description of the data it contains (Catalog) o Related: Data has some relationship to other data. In a University we have students who take courses taught by professors o By taking advantage of relationships and integration, we can provide information to users as opposed to simply data. o We can also say that the database is a model of what the users perceive. o Three main categories of models: 1. User or Conceptual Models: How users perceive the world and/or the business. 2. Logical Models: Represent the logic of how a a business operates. For example, the relationship between different entities and the flow of data through the organization. Based on the User's model. 3. Physical Models: Represent how the database is actually implemented on a computer system. This is based on the logical model. Database Management System (DBMS) A collection of software programs that are used to define, construct, maintain and manipulate data in a database. Database System (DBS) contains: The Database + The DBMS + Application Programs (what users interact with)
o

File Systems
• •



File System: A collection of individual files accessed by applications programs Limitations of a File System: o Separated and Isolated Data - Makes coordinating, assimilating and representing data difficult o Data Duplication - Wastes space and can lead to data integrity (inconsistency) problems o Application Program Dependencies - Changes to a single file can require changes to numerous application programs o Incompatible Files o Lack of Data Sharing - Difficult to control access to files, especially to individual portions of files Advantages of a DBMS A DBMS can provide: o Data Consistency and Integrity - by controlling access and minimizing data duplication o Application program independence - by storing data in a uniform fashion o Data Sharing - by controlling access to data items, many users can access data concurrently o Backup and Recovery o Security and Privacy o Multiple views of data

Example Database
An Example Database CustomerID 123 123 124 125 125 127 127
• • • • • • •

Name Mr. Smith Mr. Smith Mrs. Jones Mr. Axe Mr. Axe

Address 123 Lexington 123 Lexington 12 Davis Ave.

City

State Acct_Number Balance 9987 9980 8811 4422 4433 3322 1122 4000 2000 1000 6000 9000 500 800

Smithville KY Smithville KY Smithville KY

443 Grinder Broadville GA Ln. 443 Grinder Broadville GA Ln. Streetville Streetville GA GA

Mr. & Mrs. 661 Parker Builder Rd. Mr. & Mrs. 661 Parker Builder Rd.

What happens when a customer moves to a new house ? Who should have access to what data in this database ? What happens if Mr. and Mrs. Builder both try and withdraw $500 from account 3322 ? What happens if the system crashes just as Mr. Axe is depositing his latest paycheck ? What data is the customer concerned with ? What data is a bank manager concerned with ? Send a mailing to all customers with checking accounts having greater than $2000 balance Let all GA customers know of a new branch location

Brief History of Database Systems
• •

1940's, 50's Initial use of computers as calculators. Limited data, focus on algorithms. Science, military applications. 1960's Business uses. Organizational data, customer data, sales, inventory, accounting, etc. File system based, high emphasis on applications programs to extract and assimilate data. Larger amounts of data, relatively simple calculations.











1970's The relational model. Data separated into individual tables. Related by keys. Initially required heavy system resources. Examples: Oracle, Sybase, Informix, Digital RDB, IBM DB2. 1980's Microcomputers - the IBM PC, Apple Macintosh. Database program such as DBase (sort of), Paradox, FoxPro, MS Access. Individual user can crate, maintain small databases. Late- 1980's Local area networks. Workgroups sharing resources such as files, printers, e-mail. Client/Server Database resides on a central server, applications programs run on client PCs attached to the server over a LAN. 1990's Internet and World Wide Web make databases of all kinds available from a single type of client - the Web Browser. Data warehousing and Data Mining also emerge. Other types of Databases: o Object-Oriented Database Systems. Objects (data and methods) stored persistently. o Distributed Database Systems. Copies of data reside at different locations for redundancy or for performance reasons.

Appropriate Use for a Database




In addition to the advantages already mentioned: o Performance o Expendability, Flexibility, Scalability o Reduced application development times o Standards enforcement However, keep in mind: o DBMS has High initial cost (although falling) o DBMS has High Overhead - requires powerful computers o DBMS are not special purpose software programs e.g., contrast a canned accouting software package like Quicken or QuickBooks with DBMS like MS Access.



When is a DBMS Not Appropriate? o Database is small with a simple structure o Applications are simple, special purpose and relatively static. o Applications have real-time requirements Examples: Traffic signal control ECU patient monitoring o Concurrent, multi-user access to data is not required.

Contents of a Database
A Database contains:

• • • •

User Data Metadata Indexes Application metadata

User Data
• • • • •

Data users work with directly by entering, updating and viewing. For our purposes, data will be generally stored in tables with some relationships between tables. Each table has one or more columns. A set of columns forms a database record. Recall our example database for the bank. What were some problems we discussed ? Here is one improvement - split into 2 tables:

Customer Table CustomerID 123 124 125 127 Name Mr. Smith Mrs. Jones Mr. Axe Address 123 Lexington 12 Davis Ave. City State Smithville KY Smithville KY Streetville GA

443 Grinder Ln. Broadville GA

Mr. & Mrs. Builder 661 Parker Rd.

Accounts Table CustomerID Acct_Number Balance 123 123 124 125 125 127 127
• • •

9987 9980 8811 4422 4433 3322 1122

4000 2000 1000 6000 9000 500 800

The customer table has 4 records and 5 columns. The Accounts table has 7 records and 3 columns. Note relationship between the two tables - CustomerID column. How should we split data into the tables ? What are the relationships between the tables ?

There are questions that are answered by Database Modeling and Database Design. Metadata
• • • •

Recall that a database is self describing Metadata: Data about data. Data that describe how user data are stored in terms of table name, column name, data type, length, primary keys, etc. Metadata are typically stored in System tables or System Catalog and are typically only directly accessible by the DBMS or by the system administrator. Have a look at the Database Documentor feature of MS Access (under the tools menu, choose Analyze and then Documentor). This tool queries the system tables to give all kinds of Metadata for tables, etc. in an MS Access database.

Indexes
• • • • •

In keeping with our desire to provide users with several different views of data, indexes provide an alternate means of accessing user data. Sorting and Searching: An index for our new banking example might include the account numbers in a sorted order. Indexes allow the database to access a record without having to search through the entire table. Updating data requires an extra step: The index must also be updated. Example: Index in a book consists of two things: 1) A Keyword stored in order 2) A pointer to the rest of the information. In the case of the book, the pointer is a page number.

Applications Metadata
• • •

Many DBMS have storage facilities for forms, reports, queries and other application components. Applications Metadata is accessed via the database development programs. Example: Look at the Documentor tool in MS Access. It can also show metadata for Queries, Forms, Reports, etc.

Data Modeling and Database Design
• •

Database Design: The activity of specifying the schema of a database in a given data model Database Schema: The structure of a database that: o Captures data types, relationships and constraints in data o Is independent of any application program



Changes infrequently Data Model: o A set of primitives for defining the structure of a database. o A set of operations for specifying retrieval and updates on a database o Examples: Relational, Hierarchical, Networked, Object-Oriented
o

In this course, we focus on the Relational data model.


Database Instance or State: The actual data contained in a database at a given time.

The Database Development Process
Two overall approaches: 1. Top-Down: Design systems from an overall organization perspective 2. Bottom-Up: Design systems from a specific perspective - one system at a time. The following is a very brief outline describing the database development process.




• • •

User needs assessment and requirements gathering: Determine what the user's are looking for, what functions should be supported, how the system should behave. Data Modeling: Based on user requirements, form a logical model of the system. This logical model is then converted to a physical data model (tables, columns, relationships, etc.) that will be implemented. Implementation: Based on the data model, a database can be created. Applications are then written to perform the required functions. Testing: The system is tested using real data. Deployment: The system is deployed to users. Maintenance of the system begins.

There are many variations to this basic development process. A Systems Analysis and Design course (such as CIS 3900 for undergraduates, CIS 9490 for graduates) covers these topics in greater detail.

Designing A Database - A Brief Example
For our Bank example, lets assume that the managers are interested in creating a database to track their customers and accounts. • Tables CUSTOMERS Customer_Id, Name, Street, City, State, Zip ACCOUNTS Customer_Id, Account_Number, Account_Type, Date_Opened, Balance

Note that we use an artificial identifier (a number we make up) for the customer called Customer_Id. Given a Customer_Id, we can uniquely identify the remaining information. We call Customer_Id a Key for the CUSTOMERS table.
o o o

Customer_Id is the key for the CUSTOMERS table. Account_Number is the key for the ACCOUNTS table. Customer_Id in the ACCOUNTS table is called a Foreign Key

Notice that when naming columns in the tables we always use an underscore character and do not use any other punctuation. even though Access allows you to use spaces, etc. it is not a good idea.




Relationships The relationship between CUSTOMERS and ACCOUNTS is by Customer_Id. Since a customer may have more than one account at the bank, we call this a One to Many relationship. (1:N). Domains A domain is a set of values that a column may have. Domain also includes the type and length or size of data found in each column. CUSTOMERS Column Domain Data Type Size Customer_Id (Key) Integer Name Street City State Zip ACCOUNTS Column Customer_Id (FK) Account_Type Date_Opened Domain Data Type Size Integer 20 15 Account_Number (Key) Integer Date 20 Character 30 Character 30 Character 25 Character 2 Character 5

Character 2

Balance Real 12,2 • We use the above information to build a logical model of the database.

• •

This logical model is then converted to a physical model and implemented as tables. The following is some example data for the Accounts and Customers tables: Customer Table Customer_Id 123 124 125 127 Name Mr. Smith Mrs. Jones Mr. Axe Address 123 Lexington 12 Davis Ave. City State Zip 91232 91232 81992 81990 Smithville KY Smithville KY Streetville GA

443 Grinder Ln. Broadville GA

Mr. & Mrs. Builder 661 Parker Rd.



Accounts Table Customer_Id Account_Number Account_Type Date_Opened Balance 123 123 124 125 125 127 127 9987 9980 8811 4422 4433 3322 1122 Checking Savings Savings Checking Savings Savings Checking 10/12/89 10/12/89 01/05/92 12/01/94 12/01/94 08/22/94 11/13/88 4000.00 2000.00 1000.00 6000.00 9000.00 500.00 800.00



Business Rules Business rules allow us to specify constraints on what data can appear in tables and what operations can be performed on data in tables. For example: An account balance can never be negative. A Customer can not be deleted if they have an existing (open) account. Money can only be transferred from a "Savings" account to a "Checking" account. 4. Savings accounts with less than a $500 balance incur a service charge.
1. 2. 3.

How do we enforce business rules ?
o o

Constraints on the database Applications

For Next Week
• •

Check for formal assignments Chapters to Read

Pratt/Adamski

Elmasri/Navathe

Kroenke

McFadden

Chapters 1 and 6 Chapters 1, 2 and 16. Chapters 1, 2 Chapters 1 and 10 Read up on DBMS System and 10 (pg. 381-400) Utilities and Classification of DBMS Read Elmasri/Navathe chapter 16 on the Database Design Process • Start forming your groups (pair of students) and discussing ideas for the group projects. [Last Week] [Home] [Next Week]
File: week1.html Date: 12:55 PM 9/7/2005 All materials Copyright, 1997-2005 Richard Holowczak

Sponsor Documents

Or use your account on DocShare.tips

Hide

Forgot your password?

Or register your new account on DocShare.tips

Hide

Lost your password? Please enter your email address. You will receive a link to create a new password.

Back to log-in

Close