Upload
rudolf-mason
View
212
Download
0
Embed Size (px)
Citation preview
C20.0001 Computer-Based Systems for Management Support
Kevin Brabazon
DDatabases : Fundamentals atabases : Fundamentals
Learning objectives for Session 11Learning objectives for Session 11
Relational database fundamentals
1. Get a basic idea about the difference between OLTP and OLAP
2. Understand what a database is, and how it is different from a DBMS and and a DBA
3. Understand what relational databases are
4. Identify and distinguish between the following parts of a relational database: tables, records, fields, field values
5. Understand three types of anomalies that arise from un-normalized data
6. Understand what primary keys and foreign keys are
7. Understand entities and primary keys
OLTP and OLAPOLTP and OLAP
OLTP: Online transaction processing
– Gathering input information
– Processing that information
– Updating existing information to reflect the gathering and processing that has taken place
OLAP: Online analytical processing
– Manipulating data to support decision making
Associated with a specific transaction: A repeated, routine event in the day-to-day working of an organization.
Example of a transaction: Placing an order at Amazon.com
Performed by transaction processing systems (TPS)
What are databases?
– Collections of information that are organized according to the logical structure of that information
DatabasesDatabases
Database management systems (DBMS)
– a software application with which you can create, store, organize and retrieve data from one or many databases
– Oracle 8, Access, Sybase, Informix, DB2
Database administrator (DBA)
– Person responsible for the development and management of an organization’s databases
Relational DatabasesRelational Databases
Last Name SS# DOB Major
Smith 100201122 06/11/84 IS
Kim 200202222 1/1/85 FIN
Davis 300201232 12/31/81 MKT
Pat 999132212 3/3/88 ACC
Student
Relational databases
– Databases that use a series of logically related two-dimensional tables to store their information
– Tables are comprised of fields/records, which in turn contain field values
TableField
Record
Field value
Relational Database
Tables
Records Fields
Field values
Bytes, bits
Last Name SS# DOB Major
Smith 100201122 06/11/84 IS
Kim 200202222 1/1/85 FIN
Davis 300201232 12/31/81 MKT
Pat 999132212 3/3/88 ACC
StudentTable
Field
Record
Field value
Relational DatabasesRelational Databases
Why do we need relational databases?Why do we need relational databases?
Problems arise when data is stored in one big file
Order# Date Customer ID Last Name First Name Address ISBN Book Name Author Price
1 9/1/03 C1001 Bezos Jeff 1 Amazon Plaza #0465039138 Code and other laws of cyberspace Lessig, Lawrence $25.00
2 9/2/03 C1004 Sproull LeeDean's Office, Stern School, New York #1573928895
Digital Copyright: Protecting Intellectual Property on the Internet Litman, Jessica $55.00
3 9/3/03 C1002 Student Pat Tisch LC-12, New York #0072952849 MIS in the Information Age Haag, Stephen $98.75
4 9/4/03 C1003 Gates BillMicrosoft Corporation, Redmond #0738206679
Linked: The New Science of Networks
Barabasi, Albert-Laszlo $34.95
5 9/5/03 C1003 Gates BillMicrosoft Corporation, Redmond #0738206083
Smart Mobs: The Next Social Revolution Rheingold, Howard $29.95
6 9/6/03 C1001 Bezos Jeff 1 Amazon Plaza #0738206083 Smart Mobs: The Next Social Revolution Rheingold, Howard $29.95
7 9/7/03 C1002 Student Pat Tisch LC-12, New York #1573928895Digital Copyright: Protecting Intellectual Property on the Internet Litman, Jessica $55.00
8 9/8/03 C1001 Bezos Jeff 1 Amazon Plaza #0738206083 Smart Mobs: The Next Social Revolution Rheingold, Howard $29.95
Anomalies in un-normalized dataAnomalies in un-normalized data
Insertion anomalies
– Inability to insert a piece of information about an object that can exist independently of another object without having to insert a piece of information about the other object
Deletion anomalies
– The loss of a piece of information about one object when a piece of information about a different object is deleted
Update anomalies
– A need to change the same piece of information about an object multiple times
–Example: Adding a new customer/book before it is ordered
–Example: Deleting an order => deleting a customer/book
–Example: Changing Bill Gates’ address
What’s wrong with this Data?What’s wrong with this Data?
StudentID#
StudentName
CampusAddress
Major Phone CourseID
CourseTitle
InstructorName
A121 Joy Egbert 100 N. State StreetMIS 555-7771 MIS 350 Intro. MIS Van Deventer
A121 Joy Egbert 100 N. State StreetMIS 555-7771 MIS 372 Database Hann
A121 Joy Egbert 100 N. State StreetMIS 555-7771 MIS 375 Elec. Comm. Chatterjee
A121 Joy Egbert 100 N. State StreetMIS 555-7771 MIS 448 Strategic MIS Chatterjee
A121 Joy Egbert 100 N. State StreetMIS 555-7771 MIS 474 Telecomm Gilson
A123 Larry Mueller 123 S. State StreetMIS 555-1235 MIS 350 Intro. MIS Van Deventer
A123 Larry Mueller 123 S. State StreetMIS 555-1235 MIS 372 Database Hann
A123 Larry Mueller 123 S. State StreetMIS 555-1235 MIS 375 Elec. Comm. Chatterjee
A123 Larry Mueller 123 S. State StreetMIS 555-1235 MIS 448 Strategic MIS Chatterjee
A124 Mike Guon 125 S. Elm MGT 555-2214 MIS 350 Intro. MIS Van Deventer
A124 Mike Guon 125 S. Elm MGT 555-2214 MIS 372 Database Hann
InstructorLocation
T240C
T240F
T240D
T240D
T240E
T240C
T240F
T240D
T240D
T240C
T240F
InstructorPhone
555-2222
555-2224
555-2228
555-2228
555-2226
555-2222
555-2224
555-2228
555-2228
555-2222
555-2224
Term
F'98
F'98
F'98
F'98
F'98
F'98
F'98
F'98
F'98
F'98
F'98
Grade
A
B
B
A
C
A
B
A
C
A
A
A124 Mike Guon 125 S. Elm MGT 555-2214 MIS 375 Elec. Comm. Chatterjee
A124 Mike Guon 125 S. Elm MGT 555-2214 MIS 474 Telecomm Gilson
A126 Jackie Judson224 S. Sixth StreetMKT 555-1245 MIS 350 Intro. MIS Van Deventer
A126 Jackie Judson224 S. Sixth StreetMKT 555-1245 MIS 372 Database Hann
A126 Jackie Judson224 S. Sixth StreetMKT 555-1245 MIS 375 Elec. Comm. Chatterjee
A126 Jackie Judson224 S. Sixth StreetMKT 555-1245 MIS 474 Telecomm Gilson
... ... ... ... ... ... ... ...
T240D
T240E
T240C
T240F
T240D
T240E
...
555-2228
555-2226
555-2222
555-2224
555-2228
555-2226
...
F'98
F'98
F'98
F'98
F'98
F'98
...
B
B
A
B
B
A
...
A normalized version of Amazon’s dataA normalized version of Amazon’s data
Normalization
– The process of assuring that a database can be implemented effectively as a set of two-dimensional tables
– Prevents insertion, deletion and update anomalies
Connecting tables togetherConnecting tables together
Primary keys
– A field (or group of fields in some cases) that uniquely describes each record in a table
– Examples: Customer ID, ISBN, Order#
Foreign keys
– A field that is a primary key in one table and appears in a different table (though not as the primary key)
– Examples: Customer ID in Orders
Integrity constraints
Rules that help ensure quality of information
Defining Entity Classes and Primary KeysDefining Entity Classes and Primary Keys
• Entity class - a concept - typically people, places, or things - about which you wish to store information and that you can identify with a unique key (called the primary key).
• Primary key - a field (or group of fields in some cases) that uniquely describes each record.
• Instance - an occurrence of an entity class that can be uniquely described.
Defining Entity Classes and Primary KeysDefining Entity Classes and Primary Keys
• What are the entity classes and primary keys for the report below?