Oracle_ch1.pptx
-
Upload
jenner-patrick-lopes-brasil -
Category
Documents
-
view
216 -
download
0
Transcript of Oracle_ch1.pptx
-
8/10/2019 Oracle_ch1.pptx
1/88
Dr. Chen, Busin ess Database Systems
Chapter 1Overview of Database Concepts
Jason C.H. Chen,Ph.D.
Professor of MIS
School of Business, Gonzaga University
Spokane, WA 99258 USA
-
8/10/2019 Oracle_ch1.pptx
2/88
Dr. Chen, Busin ess Database Systems 2
Objectives
Define database terms
Identify the purpose of a database managementsystem (DBMS)
Explain database design using entity-relationshipmodels and normalization
Explain the purpose of a Structured QueryLanguage (SQL)
Understand how this textbooks topics aresequenced and how the two sample databases areused
-
8/10/2019 Oracle_ch1.pptx
3/88
-
8/10/2019 Oracle_ch1.pptx
4/88
Dr. Chen, Busin ess Database Systems 4
Data vs. Information
Users really want is
Information
What users can learn from the data
how to satisfy their best customers
how to allocate their resources most efficiently,how to minimize losses
-
8/10/2019 Oracle_ch1.pptx
5/88
Dr. Chen, Busin ess Database Systems 5
Objectives of the MIS
Deliver the right information
to the rightpeople,
at the right time,with the right form.
Ultimately, MIS should
improve the workers
productivity.
whohas what
information about
whomand when,
where, and howwillall be decided in the
process of building
an information
system.
-
8/10/2019 Oracle_ch1.pptx
6/88
Dr. Chen, Busin ess Database Systems
A Relationship Between the Organization and
the DataBase
Organizational
IS Resources:
1. Hardware
2. Software
3. Data
4. Procedures
5. People
Picture
Or
Model
Old
State
Events
New
State
Activities
DataBase
Management
Systems D.B.
Transactions
(Add, modify, delete, )
Correspond with the
processing of the events
Information must be:
1. Time: Timely,
2. Content: Accurate, relevant, and verifiable.
3. Form: Presented in a useable form.
User
TM 0-6
-
8/10/2019 Oracle_ch1.pptx
7/88
Dr. Chen, Busin ess Database Systems 7
Questions
Is MS/Access or Oracle (SQL/Server or
IBM DB2) a data base?
Why dont we just create a huge data file
containing all fields (columns)?
Have you ever created a database (with many
applications) with only one huge data filecontaining all fields (columns)?
-
8/10/2019 Oracle_ch1.pptx
8/88
Dr. Chen, Busin ess Database Systems 8
Traditional File Processing Approach
Traditional File Processing
An application uses one specialized file. For example,
purchase order processing application uses data about
supplier and products, while an order-taking application uses
data about customer, products and orders.
Problems:
Data dependence: data structures are tightly coupled with
applications. In other words, we prefer data independence.
Data redundancy: same data are repeatedly saved for
different applications.
Other problems
-
8/10/2019 Oracle_ch1.pptx
9/88
Dr. Chen, Busin ess Database Systems 9
Types of Data Processing
Two types of data processing
File-based(traditional) data processing
applications developed by Java
Data-baseddata processing
applications developed by Oracle or MS/Access)
-
8/10/2019 Oracle_ch1.pptx
10/88
Dr. Chen, Busin ess Database Systems
Three file processing systems at a Furniture Company
Duplicate
Data
What is the main
problem in the
companys processingsystems?
-
8/10/2019 Oracle_ch1.pptx
11/88
Dr. Chen, Busin ess Database Systems 11
Disadvantages of File Processing
Program-Data Dependence All programs maintain metadata for each file they use
Data Redundancy (Duplication of data)
Different systems/programs have separate copies of the same
data
Limited Data Sharing
No centralized control of data
Lengthy Development Times Programmers must design their own file formats
Excessive Program Maintenance
80% of of information systems budget
-
8/10/2019 Oracle_ch1.pptx
12/88
Dr. Chen, Busin ess Database Systems
Database Management System
DBMS manages data
resources like an operatingsystem manages hardware
resources
DBMSDatabase
containingcentralizedshared data
Application#1
Application#2
Application#3
What are the advantages of employing
Data-based F ile Processing?
-
8/10/2019 Oracle_ch1.pptx
13/88
Dr. Chen, Busin ess Database Systems
Traditional File Processing
ProductSales rep
Supplier
Data Files
PurchasingSystem
Sales
order processingsystem
Product
Applications
Name, item#,
description...
Name, item#,
description...
-
8/10/2019 Oracle_ch1.pptx
14/88
Dr. Chen, Busin ess Database Systems
Database Management Systems
Product
Sales rep
Supplier
Database
Database
Management
Systems
PurchasingSystem
Sales
order processing
system
-
8/10/2019 Oracle_ch1.pptx
15/88
Dr. Chen, Busin ess Database Systems 15
Database Terminology
Databasean organized collection of
logically related data files
Database management system
(DBMS)software used to create
and interact with the database
-
8/10/2019 Oracle_ch1.pptx
16/88
-
8/10/2019 Oracle_ch1.pptx
17/88
Dr. Chen, Busin ess Database Systems 17
Relational Databases
Data is organized in tables
Columns (fields) represent different data categories
Rows (records) contain actual data values
-
8/10/2019 Oracle_ch1.pptx
18/88
Dr. Chen, Busin ess Database Systems 18
Database Example
-
8/10/2019 Oracle_ch1.pptx
19/88
Dr. Chen, Busin ess Database Systems
Components Example
-
8/10/2019 Oracle_ch1.pptx
20/88
Dr. Chen, Busin ess Database Systems 20
Relational Database Terms
Entity:an object about which you want to store data
Table, column, row
Flat file, attribute (or field), record
Relationships:links that show how different records arerelated
Key Fields: establish relationships among records indifferent tables
Five main types of key fields: primary keys candidate keys
surrogate keys
foreign keys
composite keys
-
8/10/2019 Oracle_ch1.pptx
21/88
Dr. Chen, Busin ess Database Systems 21
Primary Keys vs. Candidate Keys
Primary key
Value must be unique for each record
Serves to identify the record
Present in every record
Cant be NULL
Should be numeric
Candidate key
Any field that could be used as the primary key
Should be a unique, unchanging numeric field
-
8/10/2019 Oracle_ch1.pptx
22/88
Dr. Chen, Busin ess Database Systems 22
Surrogate Keys
Surrogate key: created to be the records primary keyidentifier when no suitable primary key exists
Surrogate key has no real relationship to the record towhich it is assigned, other than to identify the record
uniquely Developers configure the database to generate
surrogate key values automatically
In an Oracle database, you can automatically generate
surrogate key values using a sequence Surrogate keys are always numerical fields, becausethe database generates surrogate key valuesautomatically by incrementing the previous value byone
-
8/10/2019 Oracle_ch1.pptx
23/88
Dr. Chen, Busin ess Database Systems 23
Foreign Keys
Foreign key:a field in a table that is a primary key inanother table
Foreign key creates a relationship between the two tables
Foreign key value must exist in the table where it is aprimary key
-
8/10/2019 Oracle_ch1.pptx
24/88
Dr. Chen, Busin ess Database Systems 24
Composite Key
Composite key: a unique key that you create by
combining two or more fields
Usually comprised of fields that are primary keys
in other tables
ORDER_ID PRODUCT_ID ORDER_QUANTITY
100 1 2
100 2 2
200 2 2
200 1 1
CompositeKey
-
8/10/2019 Oracle_ch1.pptx
25/88
Dr. Chen, Busin ess Database Systems 25
Database Management System
Data storage: manage the physical structure of thedatabase
Security: control user access and privileges
Multiuser access: manage concurrent data access
Backup: enable recovery options for database failures
Data access language: provide a language that allowsdatabase access
Data integrity: enable constraints or checks on data Data dictionary: maintain information about database
structure
-
8/10/2019 Oracle_ch1.pptx
26/88
-
8/10/2019 Oracle_ch1.pptx
27/88
Dr. Chen, Busin ess Database Systems
The Oracle11g Client/Server Database
Oracle11gis the latest release of Oracle Corporationsrelational database management system
All Oracle server- and client-side programs use OracleNet, a utility that enables the network communicationbetween the client and the server
-
8/10/2019 Oracle_ch1.pptx
28/88
Dr. Chen, Busin ess Database Systems 28
Linking Internal Databases to the Web
DATABASE TRENDS
N
-
8/10/2019 Oracle_ch1.pptx
29/88
Dr. Chen, Busin ess Database Systems 29
Web-Based Client/Server Database Architecture
Network
Web server
Database Server
Web Browser5. Retrieved
data
4. Data
query
7. Data-based
Web page
8. Data-based
Web page
1. Request for
data-based Web page
6. Retrieved data
3. Data query
2. Request fordata-based Web page
Legend
CommunicationsBetween Web browser
And Web server
Communications
Between Web server
And database server
-
8/10/2019 Oracle_ch1.pptx
30/88
Dr. Chen, Busin ess Database Systems 30
System Response Time
Depends on ...
the speedof the network
the sizeof the database
the waythe database is used
a personal database running on a server
might handle 10 users making databasetransactions at the same time beforebecoming overloaded.
-
8/10/2019 Oracle_ch1.pptx
31/88
Dr. Chen, Busin ess Database Systems 31
Handling server and client failures
Processing transactions
Handling high data volumes
Providing security
Servicing multiple simultaneous users
Advantages of Client/Server Database
Management Systems
-
8/10/2019 Oracle_ch1.pptx
32/88
Dr. Chen, Busin ess Database Systems
SQL, SQL*Plus, and PL/SQL
Language or Tool Description
SQL A command language for communication with the
Oracle 10/11Server from any tool or application. OracleSQL contains many extensions.
SQL*Plus An Oracle tool that recognizes and submits SQL and
PL/SQL statements to the Server for execution andcontains its own command language.
PL/SQL An Oracle Procedural Language for writing applicationlogic and manipulating data outside the database.
SQL*PlusServer
Buffer
SQL and
PL/SQL
Scripts
Terminal
-
8/10/2019 Oracle_ch1.pptx
33/88
Dr. Chen, Busin ess Database Systems 33
Design Principles
To avoid creating tables that contain redundantdata, group related items that describe a singleentity together in a common table
Do not create tables that duplicate values manytimes in different rows
When creating a database and inserting datavalues, you must specify the data type for each
column Recall that primary key fields should use a number
data type to avoid typographical, punctuation, andcase variation errors
-
8/10/2019 Oracle_ch1.pptx
34/88
Dr. Chen, Busin ess Database Systems 34
Database Design
Systems Development Life Cycle (SDLC)
Entity-relationship model (E-R model)
Normalization
-
8/10/2019 Oracle_ch1.pptx
35/88
Dr. Chen, Busin ess Database Systems
Systems Development Life Cycle
Systems Implementation
Product:Operational System
Systems Investigation(Definition)Product:
Feasibility Study
Systems AnalysisProduct:
Functional Requirements
Systems DesignProduct:
System Specifications
Systems MaintenanceProduct:
Improved System
Understand theBusinessProblem orOpportunity
Develop anInformationSystemSolution
Implement
the InformationSystemSolution
-
8/10/2019 Oracle_ch1.pptx
36/88
Dr. Chen, Busin ess Database Systems 36
Systems Development Life Cycle
(SDLC)
Systems investigationunderstanding the problem
Systems analysisunderstanding the solution
Systems designcreating the logical and physical
components Systems implementationplacing completed system
into operation
including integration, testing and deployment
Systems maintenance and reviewevaluating the
implemented system
-
8/10/2019 Oracle_ch1.pptx
37/88
Dr. Chen, Busin ess Database Systems 37
Data Models
A data model is a collection of concepts fordescribing data.
CUSTOMER ORDER
Three database models
Hierarchical
Network
Relational
-
8/10/2019 Oracle_ch1.pptx
38/88
-
8/10/2019 Oracle_ch1.pptx
39/88
Dr. Chen, Busin ess Database Systems 39
E-R Model Notation Examples
Figure 1-3 E-R Model notation examples
Please note that the name of entity should be singular even it contains multiple
instances
-
8/10/2019 Oracle_ch1.pptx
40/88
Dr. Chen, Busin ess Database Systems
Figure 1-5 JustLee Books table structures after normalization
-
8/10/2019 Oracle_ch1.pptx
41/88
-
8/10/2019 Oracle_ch1.pptx
42/88
Dr. Chen, Busin ess Database Systems 42
One-to-Many Relationship
Each occurrence of data in one entity can be
represented by many occurrences of the
data in the other entity
Example: A class has only one instructor,
but each instructor can teach many classes
Class Instructor
-
8/10/2019 Oracle_ch1.pptx
43/88
Dr. Chen, Busin ess Database Systems 43
Many-to-Many Relationship
Data can have multiple occurrences in bothentities
Example: A student can take many classes,
and each class is composed of manystudents
Can not be included in the physical database
Class Student
-
8/10/2019 Oracle_ch1.pptx
44/88
Dr. Chen, Busin ess Database Systems 44
JustLee Example E-R Model
-
8/10/2019 Oracle_ch1.pptx
45/88
Q C / h d b h f ll i bl
-
8/10/2019 Oracle_ch1.pptx
46/88
Dr. Chen, Busin ess Database Systems
ISBN TitlePublication
DateCost Retail Category Publisher Contact Author
8843172113 Database
Implementation
04-JUN-03 31.40 55.95 Computer American
Publishing
Davidson T.Peterson
8843172113 Database
Implementation
04-JUN-03 31.40 55.95 Computer American
Publishing
Davidson J.Austin
8843172113 Database
Implementation
04-JUN-03 31.40 55.95 Computer American
Publishing
Davidson J.Adams
1915762492 Handcranked
Computers
21-JUN-05 21.80 25.00 Computer Amercian
Publishing
Davidson W.White
1915762492 Handcranked
Computers
21-JUN-05 21.80 25.00 Computer Amercian
Publishing
Davidson L.White
6522489652 Meaningful
Accounting
25-MAY-08 41.60 85.00 Accounting Articulate
Publishing
Brown M.Kane
6522489652 Meaningful
Accounting
25-MAY-08 41.60 85.00 Accounting Articulate
Publishing
Brown S. Little
Q: Can we create/enter the data base on the following table
immediately?
BOOKS table
-
8/10/2019 Oracle_ch1.pptx
47/88
Dr. Chen, Busin ess Database Systems 47
Database Normalization
Purposes
design a reliable and stable data bases
increase data integrity (reduce or control dataredundancy)
Processes
determines required tables and columns for
each table
multistep process
-
8/10/2019 Oracle_ch1.pptx
48/88
Dr. Chen, Busin ess Database Systems
Problem Solving for Modeling a Database Project
Business ProblemStudy and Analyze
w/Team
???
IMPLEMENTATION
-
8/10/2019 Oracle_ch1.pptx
49/88
Dr. Chen, Busin ess Database Systems
Problem Solving for Modeling a Database Project
Business ProblemStudy and Analyze
w/Team
ER or other Model
Normalization
(3NF)
User interview &
Integrated Model
Normalization
IMPLEMENTATION
-
8/10/2019 Oracle_ch1.pptx
50/88
Dr. Chen, Busin ess Database Systems 50
Well-Structured Relations
A relation that contains minimal data redundancyand allows users to insert, delete, and update rowswithout causing data inconsistencies
Goal is to avoid (minimize)anomalies
Insertion Anomalyadding new rows forces user tocreate duplicate data
Deletion Anomalydeleting rows may cause a loss ofdata that would be needed for other future rows
Modification Anomalychanging data in a row forceschanges to other rows because of duplication
General rule of thumb: a table should not pertain to more
than one entity type
F ti l D d i d K
-
8/10/2019 Oracle_ch1.pptx
51/88
Dr. Chen, Busin ess Database Systems 51
Functional Dependencies and Keys
Functional Dependency: The value of one attribute (thedeterminant) determines the value of another attribute.
Candidate Key
A unique identifier. One of the candidate keys will becomethe primary key
E.g. perhaps there is both credit card number and SS# ina tablein this case both are candidate keys
Each non-key field is functionally dependent on everycandidate key
Figure 5-9
-
8/10/2019 Oracle_ch1.pptx
52/88
-
8/10/2019 Oracle_ch1.pptx
53/88
Dr. Chen, Busin ess Database Systems
Unnormalized Data
Contains repeating groups in the Author columnin the BOOKS table
-
8/10/2019 Oracle_ch1.pptx
54/88
-
8/10/2019 Oracle_ch1.pptx
55/88
Dr. Chen, Busin ess Database Systems 55
First-Normal Form (1NF)
Primary key (pk) is identified
Repeating groups are eliminated
Every attribute value is atomic (singled-value)
-
8/10/2019 Oracle_ch1.pptx
56/88
Dr. Chen, Busin ess Database Systems
First-Normal Form (1NF) (continued)
ISBN and Author columns together create acomposite primary key
1NF: ISBN and Author fields together create a composite primary key
-
8/10/2019 Oracle_ch1.pptx
57/88
Dr. Chen, Busin ess Database Systems
ISBN TitlePublication
DateCost Retail Category Publisher Contact Author
8843172113 Database
Implementation
04-JUN-03 31.40 55.95 Computer American
Publishing
Davidson T.Peterson
8843172113 Database
Implementation
04-JUN-03 31.40 55.95 Computer American
Publishing
Davidson J.Austin
8843172113 Database
Implementation
04-JUN-03 31.40 55.95 Computer American
Publishing
Davidson J.Adams
1915762492 Handcranked
Computers
21-JUN-05 21.80 25.00 Computer Amercian
Publishing
Davidson W.White
1915762492 Handcranked
Computers
21-JUN-05 21.80 25.00 Computer Amercian
Publishing
Davidson L.White
6522489652 Meaningful
Accounting
25-MAY-08 41.60 85.00 Accounting Articulate
Publishing
Brown M.Kane
6522489652 Meaningful
Accounting
25-MAY-08 41.60 85.00 Accounting Articulate
Publishing
Brown S. Little
1NF: ISBN and Authorfields together create a composite primary key
Q: What fields are dependent on ISBN alone ?
-
8/10/2019 Oracle_ch1.pptx
58/88
Dr. Chen, Busin ess Database Systems 58
Composite Primary Key
More than one field (column) is required to
uniquely identify a record (row).
Can lead to partial dependencya field isonly dependent on a portion of the primary
key
-
8/10/2019 Oracle_ch1.pptx
59/88
Dr. Chen, Busin ess Database Systems 59
Second-Normal Form (2NF)
1NF and everynon-key attribute is fully
functionally dependent on the primary key.
Partial dependency must be eliminatedBreak the composite primary key into two
parts, each part representing a separate table
Every non-key attribute must be defined by theentire key (either a single PKor a CK), not by
only part of the key
-
8/10/2019 Oracle_ch1.pptx
60/88
Dr. Chen, Busin ess Database Systems
Second-NormalForm (2NF) (continued)
BOOKS table in 2NF
60
ISBN TitlePublication
DateCost Retail Category Publisher Contact
8843172113 Database
Implementation
04-JUN-03 31.40 55.95 Computer American
Publishing
Davidson
1915762492 Handcranked
Computers
21-JUN-05 21.80 25.00 Computer American
Publishing
Davidson
6522489652 Meaningful
Accounting
25-MAY-08 41.60 85.00 Accounting Articulate
Publishing
Brown
ISBN Author
8843172113 T.Peterson
8843172113 J.Austin
8843172113 J.Adams
1915762492 W.White
1915762492 L.White
6522489652 M.Kane
6522489652 S. Little
1NF: ISBN and Author fields together create a composite primary key
-
8/10/2019 Oracle_ch1.pptx
61/88
Dr. Chen, Busin ess Database Systems
ISBN TitlePublication
DateCost Retail Category Publisher Contact Author
8843172113 Database
Implementation
04-JUN-03 31.40 55.95 Computer American
Publishing
Davidson T.Peterson
8843172113 Database
Implementation
04-JUN-03 31.40 55.95 Computer American
Publishing
Davidson J.Austin
8843172113 Database
Implementation
04-JUN-03 31.40 55.95 Computer American
Publishing
Davidson J.Adams
1915762492 Handcranked
Computers
21-JUN-05 21.80 25.00 Computer Amercian
Publishing
Davidson W.White
1915762492 Handcranked
Computers
21-JUN-05 21.80 25.00 Computer Amercian
Publishing
Davidson L.White
6522489652 Meaningful
Accounting
25-MAY-08 41.60 85.00 Accounting Articulate
Publishing
Brown M.Kane
6522489652 Meaningful
Accounting
25-MAY-08 41.60 85.00 Accounting Articulate
Publishing
Brown S. Little
1NF: ISBN and Authorfields together create a composite primary key
Q: What fields are dependent on ISBN alone ?
Fig: A Process from 1NF to 2NF
-
8/10/2019 Oracle_ch1.pptx
62/88
Dr. Chen, Busin ess Database Systems
ISBN Title PublicationDate
Cost Retail Category Publisher AuthorContact
Dependency on entire primary key (ISBN & Author)
Dependency on partial primary key (ISBN)
ISBN TitlePublication
DateCost Retail Category Publisher Contact Author
8843172113 DatabaseImplementation
04-JUN-03 31.40 55.95 Computer AmericanPublishing
Davidson T.Peterson
8843172113 Database
Implementation
04-JUN-03 31.40 55.95 Computer American
Publishing
Davidson J.Austin
8843172113 Database
Implementation
04-JUN-03 31.40 55.95 Computer American
Publishing
Davidson J.Adams
1915762492 Handcranked
Computers
21-JUN-05 21.80 25.00 Computer Amercian
Publishing
Davidson W.White
1915762492 Handcranked
Computers
21-JUN-05 21.80 25.00 Computer Amercian
Publishing
Davidson L.White
6522489652 Meaningful
Accounting
25-MAY-08 41.60 85.00 Accounting Articulate
Publishing
Brown M.Kane
6522489652 Meaningful
Accounting
25-MAY-08 41.60 85.00 Accounting Articulate
Publishing
Brown S. Little
Fig: A Process from1NF to 2NF
-
8/10/2019 Oracle_ch1.pptx
63/88
Dr. Chen, Busin ess Database Systems
ISBN Title PublicationDate
Cost Retail Category Publisher AuthorContact
Dependency on entire primary key (ISBN & Author)
Dependency on partial primary key (ISBN)
g: ocess o N to N
ISBN & AuthorTitle, Publication Date, Cost
ISBNTitle, Publication Date, Cost
Therefore, NOT in 2ndNormal Form!!
Fig: A Process from 1NF to 2NF
-
8/10/2019 Oracle_ch1.pptx
64/88
Dr. Chen, Busin ess Database Systems
ISBN Title PublicationDate
Cost Retail Category Publisher AuthorContact
Dependency on entire primary key (ISBN & Author)
Dependency on partial primary key (ISBN)
g
ISBN TitlePublication
DateCost Retail Category Publisher Contact
ISBN Author
-
8/10/2019 Oracle_ch1.pptx
65/88
-
8/10/2019 Oracle_ch1.pptx
66/88
Dr. Chen, Busin ess Database Systems
Figure 1-5 JustLee Books table structures after normalization
Fig re: 5 22 Steps in normali ation
-
8/10/2019 Oracle_ch1.pptx
67/88
Dr. Chen, Busin ess Database Systems
Table with Repeating
Group attributes
First normal
form (1NF)
Second normal
form(2NF)
Third normalform (3NF)
Boyce-Codd normal
form (BC-NF)
Fourth normalForm (4NF)
Fifth normal
form (5NF)
Remove Repeating
Group Attributes
Remove remaining
anomalies resulting from
multiple candidate keys
Remove Multivalued
Dependencies
Remove Remaining
Anomalies
Figure: 5-22 Steps in normalization
Remove Partial
Dependencies
Remove Transitive
Dependencies
-
8/10/2019 Oracle_ch1.pptx
68/88
-
8/10/2019 Oracle_ch1.pptx
69/88
Fig: A Process from 2NF to 3NF
-
8/10/2019 Oracle_ch1.pptx
70/88
Dr. Chen, Busin ess Database Systems
ISBN TitlePublication
DateCost Retail Category Publisher Contact
ISBN
TitleISBNPublication Date
ISBNCategory
ISBNPublisher
ISBNContactand
BUT
ISBNCategoryContact
implies
Transitive dependency
(not in 3rdNF)
ISBN Contact
CategoryContact
All this is OK
(2ndNF)
All non-key fields are dependent on pk (ISBN)
anon-key field is dep. on another
non-key field
Fig: A Process from 2NF to 3NF
-
8/10/2019 Oracle_ch1.pptx
71/88
Dr. Chen, Busin ess Database Systems
ISBN Title PublicationDate Cost Retail Category Publisher Contact
ISBN TitlePublication
DateCost Retail Category Publisher
Category Contact
-
8/10/2019 Oracle_ch1.pptx
72/88
Dr. Chen, Busin ess Database Systems
Third-Normal Form (3NF)
Publisher contactname has been removed
TABLE 1-5 The BOOKS Table in 3NF
Category Contact
Computer Davidson
Accounting Brown
ISBN TitlePublication
DateCost Retail Category Publisher
8843172113 Database
Implementation
04-JUN-03 31.40 55.95 Computer American
Publishing
1915762492 Handcranked
Computers
21-JUN-05 21.80 25.00 Computer American
Publishing
6522489652 Meaningful
Accounting
25-MAY-08 41.60 85.00 Accounting Articulate
Publishing
We might further create a look up table
for Category (see Table 1-6, p.12)
Fig: A Process from 2NF to 3NF
-
8/10/2019 Oracle_ch1.pptx
73/88
Dr. Chen, Busin ess Database Systems
ISBN TitlePublication
DateCost Retail Category Publisher Contact
8843172113 Database
Implementation
04-JUN-03 31.40 55.95 Computer American
Publishing
Davidson
1915762492 Handcranked
Computers
21-JUN-05 21.80 25.00 Computer American
Publishing
Davidson
6522489652 Meaningful
Accounting
25-MAY-08 41.60 85.00 Accounting Articulate
Publishin
g
Brown
Category Contact
Computer Davidson
Accounting Brown
ISBN TitlePublication
DateCost Retail Category Publisher
8843172113 Database
Implementation
04-JUN-03 31.40 55.95 Computer American
Publishing
1915762492 Handcranked
Computers
21-JUN-05 21.80 25.00 Computer American
Publishing
6522489652 MeaningfulAccounting
25-MAY-08 41.60 85.00 Accounting ArticulatePublishing
-
8/10/2019 Oracle_ch1.pptx
74/88
Q: How many tables on the 3NF?
-
8/10/2019 Oracle_ch1.pptx
75/88
Dr. Chen, Busin ess Database Systems
ISBN TitlePublication
DateCost Retail Category Publisher AuthorContact
ISBN Author
Category Contact
ISBN TitlePublication
DateCost Retail Category Publisher
Q: How many tables on the 3NF?
Answer: Three tables. What are they?
Note that You cant do anyimplementation until you transform
a table into 3NF (with more tables
produced)
BOOKS
BOOK_AUTHOR
CATEGORY_CONTACT
Processes from 1NF 2NF 3NF
-
8/10/2019 Oracle_ch1.pptx
76/88
Dr. Chen, Busin ess Database Systems
Category Contact
Computer Davidson
Accounting Brown
ISBN TitlePublication
DateCost Retail Category Publisher
8843172113 Database
Implementation
04-JUN-03 31.40 55.95 Computer American
Publishing
1915762492 Handcranked
Computers
21-JUN-05 21.80 25.00 Computer American
Publishing
6522489652 Meaningful
Accounting
25-MAY-08 41.60 85.00 Accounting Articulate
Publishing
ISBN Author
8843172113 T.Peterson
8843172113 J.Austin
8843172113 J.Adams
1915762492 W.White
1915762492 L.White
6522489652 M.Kane
6522489652 S. Little
ISBN TitlePublication
DateCost Retail Category Publisher Contact Author
8843172113 Database
Implementation
04-JUN-03 31.40 55.95 Computer American
Publishing
Davidson T.Peterson
8843172113 Database
Implementation
04-JUN-03 31.40 55.95 Computer American
Publishing
Davidson J.Austin
8843172113 Database
Implementation
04-JUN-03 31.40 55.95 Computer American
Publishing
Davidson J.Adams
1915762492 Handcranked
Computers
21-JUN-05 21.80 25.00 Computer Amercian
Publishing
Davidson W.White
1915762492 Handcranked
Computers
21-JUN-05 21.80 25.00 Computer Amercian
Publishing
Davidson L.White
6522489652 Meaningful
Accounting
25-MAY-08 41.60 85.00 Accounting Articulate
Publishing
Brown M.Kane
6522489652 Meaningful
Accounting
25-MAY-08 41.60 85.00 Accounting Articulate
Publishing
Brown S. Little
Category Code Category
10 Computer
50 Accounting
fk(foreign key)
We will learn all detailed processes in the main text (ch.4)
-
8/10/2019 Oracle_ch1.pptx
77/88
-
8/10/2019 Oracle_ch1.pptx
78/88
Dr. Chen, Busin ess Database Systems 78
Summary of Normalization Steps
1NF: eliminate repeating groups, identify
the primary key
2NF: table is in 1NF, and partialdependencies are eliminated
3NF: table is in 2NF, and transitive
dependencies are eliminated
Figure: 5-22 Steps in normalization
-
8/10/2019 Oracle_ch1.pptx
79/88
Dr. Chen, Busin ess Database Systems
Table with Repeating
Group attributes
First normal
form (1NF)
Second normal
form(2NF)
Third normal
form (3NF)
Boyce-Codd normal
form (BC-NF)
Fourth normal
Form (4NF)
Fifth normal
form (5NF)
Remove Repeating
Group Attributes
Remove remaining
anomalies resulting from
multiple candidate keys
Remove Multivalued
Dependencies
Remove Remaining
Anomalies
g p
Remove Partial
Dependencies
Remove Transitive
Dependencies
-
8/10/2019 Oracle_ch1.pptx
80/88
Dr. Chen, Busin ess Database Systems 80
Relating Tables within the Database
Once tables are normalized, make certain
tables are linked
Tables are linked through a common field A common field is usually a primary key in
one table and a foreign key in the other
table
-
8/10/2019 Oracle_ch1.pptx
81/88
Dr. Chen, Busin ess Database Systems
Category
Contact
Category_Contact
-
8/10/2019 Oracle_ch1.pptx
82/88
-
8/10/2019 Oracle_ch1.pptx
83/88
Dr. Chen, Busin ess Database Systems 83
Structured Query Language (SQL)
Data sublanguage
Used to:
Create or modify tablesAdd data to tables
Edit data in tables
Retrieve data from tables ANSI and ISO standards
Databases Used in this Textbook
-
8/10/2019 Oracle_ch1.pptx
84/88
Dr. Chen, Busin ess Database Systems 84
Databases Used in this Textbook
JustLee Books Database
Assumptions
No back orders or partial shipments
Only U.S. addressesCompleted orders are transferred to the annual
SALES table at the end of each month to enable
faster processing on the ORDERS table
T i S
-
8/10/2019 Oracle_ch1.pptx
85/88
Dr. Chen, Busin ess Database Systems 85
Topic Sequence
The first half of the text will focus on
creating a database
The second half of the text will focus onquerying or retrieving data from a database
Summary
-
8/10/2019 Oracle_ch1.pptx
86/88
Dr. Chen, Busin ess Database Systems 86
Summary
A DBMS is used to create and maintain a database
A database is composed of a group of interrelated tables A file is a group of related records; a file is also called a table in the
physical database
A record is a group of related fields regarding one specific entity; a
record is also called a row A common field is used to join data contained in different tables
A primary key is used to uniquely identify each record
A foreign key is a common field that exists between two tables butis also a primary key in one of the tables
A lookup table is a common term for a table referenced in a foreignkey
A Structured Query Language (SQL) is a data sublanguage thatnavigates the data stored within a databases tables
S ( ti d)
-
8/10/2019 Oracle_ch1.pptx
87/88
Dr. Chen, Busin ess Database Systems 87
Summary (continued)
A record is considered unnormalized if it contains repeatinggroups
A record is in first-normal form (1NF) if no repeatinggroups exist and it has a primary key
Second-normal form (2NF) is achieved if the record is in1NF and has no partial dependencies
After a record is in 2NF and all transitive dependencies havebeen removed, then it is in third-normal form (3NF), whichis generally sufficient for most databases
Homework: Transform it into 3NF
-
8/10/2019 Oracle_ch1.pptx
88/88
SALES relation with simple data
Cust_ID Name Salesperson Region
8023 Anderson 101 South
9167 Bancroft 102 West
7924 Hobbs 101 South
6837 Tucker 103 East
8596 Eckersley 102 West
7018 Arnold 104 North
SALES