SlideShare a Scribd company logo
1 of 35
INFM 603 – Information Technology
and Organizational Context
Lecture 7
Database Fundamentals
2
A Database Schema
Tables Indexes Procedures
Views Constraints
Schema Owner
schema objects
1) Stephens, R.K. and Plew. R.R., 2001. Database Design. SAMS, Indianapolis , IN. (with slight changes by V.G.D.)
[1]
3
Caution about Schema Objects
• The meaning of “object” here is different
than that in UML.
4
Table
• “A table is the primary unit of physical
storage for data in a database.”1
• Usually a database contains more than one
table.
1) Stephens, R.K. and Plew. R.R., 2001. Database Design. SAMS, Indianapolis , IN.
5
Table
6
A Database with Multiple Tables
Publishers Books Customers
Authors Inventory Orders
1) Stephens, R.K. and Plew. R.R., 2001. Database Design. SAMS, Indianapolis , IN. (with slight changes by V.G.D.)
[1]
7
Table
Customers
8
Field (Column)
a field
Customers
9
Record (Row)
a record
Customers
10
Primary Key
primary key field
Customers
Primary key is a unique identifier of records in a table.
Primary key values may be generated manually or automatically.
11
Primary Key
primary key fields
Roles (Performances)
A primary key can consist of more than one field.
12
Foreign Key
foreign key field
primary key field
parent table
Directors
Movies
child table
relationship
13
Relationship Types
• One-to-one
• One-to-many
• Many-to-many
14
Data Types
• Alphanumeric (Text, Memo)
• Numeric (Number, Currency, etc.)
• Date/Time
• Boolean (Yes/No)
15
Entity
• “An entity is a business object that
represents a group, or category of data.”1
• Do we know a similar concept?
1) Stephens, R.K. and Plew. R.R., 2001. Database Design, pp. 21. SAMS, Indianapolis , IN.
16
Instance (Record, Tuple)
• “A single, specific occurrence of an entity is
an instance. Other terms for an instance are
record and tuple.”1
• Do we know a similar concept?
1) Stephens, R.K. and Plew. R.R., 2001. Database Design, pp. 210. SAMS, Indianapolis , IN.
17
Attribute
• “An attribute is a sub-group of information
within an entity.”1
• Do we know a similar concept?
1) Stephens, R.K. and Plew. R.R., 2001. Database Design, pp. 21. SAMS, Indianapolis , IN.
18
Relationship
• A relationship is a link that relates two
entities that share one or more attributes.
• Do we know a similar concept?
19
OO Design  DB Design
• Class  Entity (Table)
• Object  Record
• Attribute  Attribute (Field)
• Association  Relationship
• …
20
Database Environments
• Mainframe
• Client/Server
• Internet-based
21
Database Types
• Flat-file
• Hierarchical
• Network
• Relational
• Object-oriented
• Object-relational
INFM 603 – Information Technology
and Organizational Context
Lecture 7
Normalization
(Advanced – may not be required for
LBSC690)
23
Normalization
• A method for organizing data elements into
tables.
• Done in order to avoid
– Duplication of data
– Insert anomaly
– Delete anomaly
– Update anomaly
24
We will look at
• First Normal Form
• Second Normal Form
• Third Normal Form
25
Example (Unnormalized)
• Table: SalesOrders (Un-normalized)
– SalesOrderNo
– Date
– CustomerNo
– CustomerName
– CutomerAddress
– ClerkNo
– ClerkName
– Item1Description
– Item1Quantity
– Item1UnitPrice
– Item2Description
– Item2Quantity
– Item2UnitPrice
– Item3Description
– Item3Quantity
– Item3UnitPrice
– Total
26
Normalize into 1NF
• Separate repeating groups into new tables.
• Start a new table for the repeating data.
• The primary key for the repeating group is
usually a composite key.
27
Example (1NF)
• Table: SalesOrders
– SalesOrderNo
– Date
– CustomerNo
– CustomerName
– CustomerAddress
– ClerkNo
– ClerkName
– Total
• Table: OrderItems
– SalesOrderNo
– ItemNo
– ItemDescription
– ItemQuantity
– ItemUnitPrice
28
Normalize into 2NF
• Remove partial dependencies.
• Start a new table for the partially dependent
data and the part of the key it depends on.
• Tables started at this step usually contain
descriptions of resources.
29
Dependencies
• Functional dependency: The value of one
attribute depends entirely on the value of
another.
• Partial dependency: An attribute depends on
only part of the primary key. (The primary
key must be a composite key.)
• Transitive dependency: An attribute depends
on an attribute other than the primary key.
30
Example (2NF)
• Table: OrderItems
– SalesOrderNo
– ItemNo
– ItemQuantity
– ItemUnitPrice
• Table: InventoryItems
– ItemNo
– ItemDescription
31
What if we did not do 2NF
• Duplication of data: ItemDescription would appear
for every order.
• Insert anomaly: To insert an inventory item, you
must insert a sales order.
• Delete anomaly: Information about the items stay
with sales order records. Delete a sales order
record, delete the item description.
• Update anomaly: To change an item description,
you must change all the sales order records that
have the item.
32
Normalize into 3NF
• Remove transitive dependencies.
• Start a new table for the transitively dependent
attribute and the attribute it depends on.
• Keep a copy of the key attribute in the original
table.
33
Example (3NF)
• Table: SalesOrders
– SalesOrderNo
– Date
– CustomerNo
– ClerkNo
– Total
• Table: Customers
– CustomerNo
– CustomerName
– CustomerAddress
• Table: Clerks
– ClerkNo
– ClerkName
34
What if we did not do 3NF
• Duplication of data: Customer and Clerk details
would appear for every order.
• Insert anomaly: To insert a customer or clerk, you
must insert a sales order.
• Delete anomaly: Information about the customers
and clerks stay with sales order records. Delete a
sales order record, delete the customer or clerk.
• Update anomaly: To change the details of a
customer or clerk, you must change all the sales
order records that involve that customer or clerk.
35
Example (Final Tables)
• Table: SalesOrders
– SalesOrderNo
– Date
– CustomerNo
– ClerkNo
– Total
• Table: OrderItems
– SalesOrderNo
– ItemNo
– ItemQuantity
– ItemUnitPrice
• Table: InventoryItems
– ItemNo
– ItemDescription
• Table: Customers
– CustomerNo
– CustomerName
– CustomerAddress
• Table: Clerks
– ClerkNo
– ClerkName

More Related Content

Similar to DatabaseFundamentals.ppt

Csis110 trzos-c1 ms access
Csis110 trzos-c1 ms accessCsis110 trzos-c1 ms access
Csis110 trzos-c1 ms access
tomtrzos
 

Similar to DatabaseFundamentals.ppt (20)

Topics-Ch4Ch5.ppt
Topics-Ch4Ch5.pptTopics-Ch4Ch5.ppt
Topics-Ch4Ch5.ppt
 
Database
DatabaseDatabase
Database
 
Csis110 trzos-c1 ms access
Csis110 trzos-c1 ms accessCsis110 trzos-c1 ms access
Csis110 trzos-c1 ms access
 
Unit 1 linked list
Unit 1 linked listUnit 1 linked list
Unit 1 linked list
 
CS101- Introduction to Computing- Lecture 37
CS101- Introduction to Computing- Lecture 37CS101- Introduction to Computing- Lecture 37
CS101- Introduction to Computing- Lecture 37
 
Database Performance
Database PerformanceDatabase Performance
Database Performance
 
Chapter 9 Data Design .pptxInformation Technology Project Management
Chapter 9 Data Design .pptxInformation Technology Project ManagementChapter 9 Data Design .pptxInformation Technology Project Management
Chapter 9 Data Design .pptxInformation Technology Project Management
 
overview of database concept
overview of database conceptoverview of database concept
overview of database concept
 
Data structure unitfirst part1
Data structure unitfirst part1Data structure unitfirst part1
Data structure unitfirst part1
 
Data structure unitfirst part1
Data structure unitfirst part1Data structure unitfirst part1
Data structure unitfirst part1
 
SAP ABAP data dictionary
SAP ABAP data dictionarySAP ABAP data dictionary
SAP ABAP data dictionary
 
Databases for beginners.pdf
Databases for beginners.pdfDatabases for beginners.pdf
Databases for beginners.pdf
 
Unit I Database concepts - RDBMS & ORACLE
Unit I  Database concepts - RDBMS & ORACLEUnit I  Database concepts - RDBMS & ORACLE
Unit I Database concepts - RDBMS & ORACLE
 
Chapter – 2 Data Models.pdf
Chapter – 2 Data Models.pdfChapter – 2 Data Models.pdf
Chapter – 2 Data Models.pdf
 
DB2 on Mainframe
DB2 on MainframeDB2 on Mainframe
DB2 on Mainframe
 
Feb 2nd Makeup Class
Feb 2nd Makeup ClassFeb 2nd Makeup Class
Feb 2nd Makeup Class
 
Introduction to ms access database
Introduction to ms access databaseIntroduction to ms access database
Introduction to ms access database
 
Python data structures (Lists and tuples) presentation
Python data structures (Lists and tuples) presentationPython data structures (Lists and tuples) presentation
Python data structures (Lists and tuples) presentation
 
data_modelling_101.pptx
data_modelling_101.pptxdata_modelling_101.pptx
data_modelling_101.pptx
 
Ms sql server tips 1 0
Ms sql server tips 1 0Ms sql server tips 1 0
Ms sql server tips 1 0
 

More from wondmhunegn (11)

sql-basic.ppt
sql-basic.pptsql-basic.ppt
sql-basic.ppt
 
Microsoft Access.ppt
Microsoft Access.pptMicrosoft Access.ppt
Microsoft Access.ppt
 
Module 2 Slides.ppt
Module 2 Slides.pptModule 2 Slides.ppt
Module 2 Slides.ppt
 
ETE105_lecture 3.ppt
ETE105_lecture 3.pptETE105_lecture 3.ppt
ETE105_lecture 3.ppt
 
BasicComputerParts.ppt
BasicComputerParts.pptBasicComputerParts.ppt
BasicComputerParts.ppt
 
tree.ppt
tree.ppttree.ppt
tree.ppt
 
Chapter 1 Data structure.pptx
Chapter 1 Data structure.pptxChapter 1 Data structure.pptx
Chapter 1 Data structure.pptx
 
IS230 - Chapter 4 - Keys and Relationship - Revised.ppt
IS230 - Chapter 4 - Keys and Relationship - Revised.pptIS230 - Chapter 4 - Keys and Relationship - Revised.ppt
IS230 - Chapter 4 - Keys and Relationship - Revised.ppt
 
MS-Access Tables Forms Queries Reports.ppt
MS-Access Tables Forms Queries Reports.pptMS-Access Tables Forms Queries Reports.ppt
MS-Access Tables Forms Queries Reports.ppt
 
Data Types and Field Properties.ppt
Data Types and Field Properties.pptData Types and Field Properties.ppt
Data Types and Field Properties.ppt
 
Template.pptx
Template.pptxTemplate.pptx
Template.pptx
 

Recently uploaded

Call Girls In Bellandur ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bellandur ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bellandur ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bellandur ☎ 7737669865 🥵 Book Your One night Stand
amitlee9823
 
Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...
Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...
Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...
amitlee9823
 
Call Girls Bommasandra Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Bommasandra Just Call 👗 7737669865 👗 Top Class Call Girl Service B...Call Girls Bommasandra Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Bommasandra Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
amitlee9823
 
Escorts Service Kumaraswamy Layout ☎ 7737669865☎ Book Your One night Stand (B...
Escorts Service Kumaraswamy Layout ☎ 7737669865☎ Book Your One night Stand (B...Escorts Service Kumaraswamy Layout ☎ 7737669865☎ Book Your One night Stand (B...
Escorts Service Kumaraswamy Layout ☎ 7737669865☎ Book Your One night Stand (B...
amitlee9823
 
Probability Grade 10 Third Quarter Lessons
Probability Grade 10 Third Quarter LessonsProbability Grade 10 Third Quarter Lessons
Probability Grade 10 Third Quarter Lessons
JoseMangaJr1
 
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al BarshaAl Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
AroojKhan71
 
Vip Mumbai Call Girls Marol Naka Call On 9920725232 With Body to body massage...
Vip Mumbai Call Girls Marol Naka Call On 9920725232 With Body to body massage...Vip Mumbai Call Girls Marol Naka Call On 9920725232 With Body to body massage...
Vip Mumbai Call Girls Marol Naka Call On 9920725232 With Body to body massage...
amitlee9823
 
Vip Mumbai Call Girls Thane West Call On 9920725232 With Body to body massage...
Vip Mumbai Call Girls Thane West Call On 9920725232 With Body to body massage...Vip Mumbai Call Girls Thane West Call On 9920725232 With Body to body massage...
Vip Mumbai Call Girls Thane West Call On 9920725232 With Body to body massage...
amitlee9823
 
Call Girls In Doddaballapur Road ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Doddaballapur Road ☎ 7737669865 🥵 Book Your One night StandCall Girls In Doddaballapur Road ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Doddaballapur Road ☎ 7737669865 🥵 Book Your One night Stand
amitlee9823
 

Recently uploaded (20)

Discover Why Less is More in B2B Research
Discover Why Less is More in B2B ResearchDiscover Why Less is More in B2B Research
Discover Why Less is More in B2B Research
 
Call Girls In Bellandur ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bellandur ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bellandur ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bellandur ☎ 7737669865 🥵 Book Your One night Stand
 
Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...
Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...
Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...
 
Accredited-Transport-Cooperatives-Jan-2021-Web.pdf
Accredited-Transport-Cooperatives-Jan-2021-Web.pdfAccredited-Transport-Cooperatives-Jan-2021-Web.pdf
Accredited-Transport-Cooperatives-Jan-2021-Web.pdf
 
Call Girls Bommasandra Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Bommasandra Just Call 👗 7737669865 👗 Top Class Call Girl Service B...Call Girls Bommasandra Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Bommasandra Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
 
Halmar dropshipping via API with DroFx
Halmar  dropshipping  via API with DroFxHalmar  dropshipping  via API with DroFx
Halmar dropshipping via API with DroFx
 
Escorts Service Kumaraswamy Layout ☎ 7737669865☎ Book Your One night Stand (B...
Escorts Service Kumaraswamy Layout ☎ 7737669865☎ Book Your One night Stand (B...Escorts Service Kumaraswamy Layout ☎ 7737669865☎ Book Your One night Stand (B...
Escorts Service Kumaraswamy Layout ☎ 7737669865☎ Book Your One night Stand (B...
 
5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed
5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed
5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed
 
April 2024 - Crypto Market Report's Analysis
April 2024 - Crypto Market Report's AnalysisApril 2024 - Crypto Market Report's Analysis
April 2024 - Crypto Market Report's Analysis
 
Probability Grade 10 Third Quarter Lessons
Probability Grade 10 Third Quarter LessonsProbability Grade 10 Third Quarter Lessons
Probability Grade 10 Third Quarter Lessons
 
(NEHA) Call Girls Katra Call Now 8617697112 Katra Escorts 24x7
(NEHA) Call Girls Katra Call Now 8617697112 Katra Escorts 24x7(NEHA) Call Girls Katra Call Now 8617697112 Katra Escorts 24x7
(NEHA) Call Girls Katra Call Now 8617697112 Katra Escorts 24x7
 
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...
 
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al BarshaAl Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
 
Vip Mumbai Call Girls Marol Naka Call On 9920725232 With Body to body massage...
Vip Mumbai Call Girls Marol Naka Call On 9920725232 With Body to body massage...Vip Mumbai Call Girls Marol Naka Call On 9920725232 With Body to body massage...
Vip Mumbai Call Girls Marol Naka Call On 9920725232 With Body to body massage...
 
Call me @ 9892124323 Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
Call me @ 9892124323  Cheap Rate Call Girls in Vashi with Real Photo 100% SecureCall me @ 9892124323  Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
Call me @ 9892124323 Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
 
Vip Mumbai Call Girls Thane West Call On 9920725232 With Body to body massage...
Vip Mumbai Call Girls Thane West Call On 9920725232 With Body to body massage...Vip Mumbai Call Girls Thane West Call On 9920725232 With Body to body massage...
Vip Mumbai Call Girls Thane West Call On 9920725232 With Body to body massage...
 
Midocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFxMidocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFx
 
Call Girls In Doddaballapur Road ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Doddaballapur Road ☎ 7737669865 🥵 Book Your One night StandCall Girls In Doddaballapur Road ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Doddaballapur Road ☎ 7737669865 🥵 Book Your One night Stand
 
Mature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptxMature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptx
 
BigBuy dropshipping via API with DroFx.pptx
BigBuy dropshipping via API with DroFx.pptxBigBuy dropshipping via API with DroFx.pptx
BigBuy dropshipping via API with DroFx.pptx
 

DatabaseFundamentals.ppt

  • 1. INFM 603 – Information Technology and Organizational Context Lecture 7 Database Fundamentals
  • 2. 2 A Database Schema Tables Indexes Procedures Views Constraints Schema Owner schema objects 1) Stephens, R.K. and Plew. R.R., 2001. Database Design. SAMS, Indianapolis , IN. (with slight changes by V.G.D.) [1]
  • 3. 3 Caution about Schema Objects • The meaning of “object” here is different than that in UML.
  • 4. 4 Table • “A table is the primary unit of physical storage for data in a database.”1 • Usually a database contains more than one table. 1) Stephens, R.K. and Plew. R.R., 2001. Database Design. SAMS, Indianapolis , IN.
  • 6. 6 A Database with Multiple Tables Publishers Books Customers Authors Inventory Orders 1) Stephens, R.K. and Plew. R.R., 2001. Database Design. SAMS, Indianapolis , IN. (with slight changes by V.G.D.) [1]
  • 10. 10 Primary Key primary key field Customers Primary key is a unique identifier of records in a table. Primary key values may be generated manually or automatically.
  • 11. 11 Primary Key primary key fields Roles (Performances) A primary key can consist of more than one field.
  • 12. 12 Foreign Key foreign key field primary key field parent table Directors Movies child table relationship
  • 13. 13 Relationship Types • One-to-one • One-to-many • Many-to-many
  • 14. 14 Data Types • Alphanumeric (Text, Memo) • Numeric (Number, Currency, etc.) • Date/Time • Boolean (Yes/No)
  • 15. 15 Entity • “An entity is a business object that represents a group, or category of data.”1 • Do we know a similar concept? 1) Stephens, R.K. and Plew. R.R., 2001. Database Design, pp. 21. SAMS, Indianapolis , IN.
  • 16. 16 Instance (Record, Tuple) • “A single, specific occurrence of an entity is an instance. Other terms for an instance are record and tuple.”1 • Do we know a similar concept? 1) Stephens, R.K. and Plew. R.R., 2001. Database Design, pp. 210. SAMS, Indianapolis , IN.
  • 17. 17 Attribute • “An attribute is a sub-group of information within an entity.”1 • Do we know a similar concept? 1) Stephens, R.K. and Plew. R.R., 2001. Database Design, pp. 21. SAMS, Indianapolis , IN.
  • 18. 18 Relationship • A relationship is a link that relates two entities that share one or more attributes. • Do we know a similar concept?
  • 19. 19 OO Design  DB Design • Class  Entity (Table) • Object  Record • Attribute  Attribute (Field) • Association  Relationship • …
  • 20. 20 Database Environments • Mainframe • Client/Server • Internet-based
  • 21. 21 Database Types • Flat-file • Hierarchical • Network • Relational • Object-oriented • Object-relational
  • 22. INFM 603 – Information Technology and Organizational Context Lecture 7 Normalization (Advanced – may not be required for LBSC690)
  • 23. 23 Normalization • A method for organizing data elements into tables. • Done in order to avoid – Duplication of data – Insert anomaly – Delete anomaly – Update anomaly
  • 24. 24 We will look at • First Normal Form • Second Normal Form • Third Normal Form
  • 25. 25 Example (Unnormalized) • Table: SalesOrders (Un-normalized) – SalesOrderNo – Date – CustomerNo – CustomerName – CutomerAddress – ClerkNo – ClerkName – Item1Description – Item1Quantity – Item1UnitPrice – Item2Description – Item2Quantity – Item2UnitPrice – Item3Description – Item3Quantity – Item3UnitPrice – Total
  • 26. 26 Normalize into 1NF • Separate repeating groups into new tables. • Start a new table for the repeating data. • The primary key for the repeating group is usually a composite key.
  • 27. 27 Example (1NF) • Table: SalesOrders – SalesOrderNo – Date – CustomerNo – CustomerName – CustomerAddress – ClerkNo – ClerkName – Total • Table: OrderItems – SalesOrderNo – ItemNo – ItemDescription – ItemQuantity – ItemUnitPrice
  • 28. 28 Normalize into 2NF • Remove partial dependencies. • Start a new table for the partially dependent data and the part of the key it depends on. • Tables started at this step usually contain descriptions of resources.
  • 29. 29 Dependencies • Functional dependency: The value of one attribute depends entirely on the value of another. • Partial dependency: An attribute depends on only part of the primary key. (The primary key must be a composite key.) • Transitive dependency: An attribute depends on an attribute other than the primary key.
  • 30. 30 Example (2NF) • Table: OrderItems – SalesOrderNo – ItemNo – ItemQuantity – ItemUnitPrice • Table: InventoryItems – ItemNo – ItemDescription
  • 31. 31 What if we did not do 2NF • Duplication of data: ItemDescription would appear for every order. • Insert anomaly: To insert an inventory item, you must insert a sales order. • Delete anomaly: Information about the items stay with sales order records. Delete a sales order record, delete the item description. • Update anomaly: To change an item description, you must change all the sales order records that have the item.
  • 32. 32 Normalize into 3NF • Remove transitive dependencies. • Start a new table for the transitively dependent attribute and the attribute it depends on. • Keep a copy of the key attribute in the original table.
  • 33. 33 Example (3NF) • Table: SalesOrders – SalesOrderNo – Date – CustomerNo – ClerkNo – Total • Table: Customers – CustomerNo – CustomerName – CustomerAddress • Table: Clerks – ClerkNo – ClerkName
  • 34. 34 What if we did not do 3NF • Duplication of data: Customer and Clerk details would appear for every order. • Insert anomaly: To insert a customer or clerk, you must insert a sales order. • Delete anomaly: Information about the customers and clerks stay with sales order records. Delete a sales order record, delete the customer or clerk. • Update anomaly: To change the details of a customer or clerk, you must change all the sales order records that involve that customer or clerk.
  • 35. 35 Example (Final Tables) • Table: SalesOrders – SalesOrderNo – Date – CustomerNo – ClerkNo – Total • Table: OrderItems – SalesOrderNo – ItemNo – ItemQuantity – ItemUnitPrice • Table: InventoryItems – ItemNo – ItemDescription • Table: Customers – CustomerNo – CustomerName – CustomerAddress • Table: Clerks – ClerkNo – ClerkName