SlideShare une entreprise Scribd logo
1  sur  40
A Guide to SQL, Ninth Edition
Chapter Two
Database Design
Fundamentals
2
Objectives
• Understand the terms entity, attribute, and
relationship
• Understand the terms relation and
relational database
• Understand functional dependence and be
able to identify when one column is
functionally dependent on another
• Understand the term primary key and
identify primary keys in tables
©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as
permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
3
Objectives (continued)
• Design a database to satisfy a set of
requirements
• Convert an unnormalized relation to first
normal form
• Convert tables from first normal form to
second normal form
• Convert tables from second normal form
to third normal form
©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as
permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
4
Objectives (continued)
• Create an entity-relationship diagram to
represent the design of a database
©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as
permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
5
Introduction
• Database design
– Process of determining the particular tables
and columns that will comprise a database
• Must understand database concepts
• Process of normalization
©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as
permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
6
Database Concepts
• Entity
• Attribute
• Relationship
• Functional dependence
• Primary key
©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as
permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
7
Relational Database
• A collection of tables
• Tables in TAL Distributors Database
– Rep
– Customer
– Orders
– Item
– Order_Line
©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as
permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
8
Entities, Attributes, and
Relationships
• Entity (like a noun)
– A person, place, thing, or event
• Attribute (like an adjective or adverb)
– Property of an entity
• Relationship
– Association between entities
©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as
permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
9
Entities, Attributes, and
Relationships (continued)
• One-to-many relationship
– One rep is related to many customers
– Implement by having a common column in
two or more tables
• REP_NUM is a column in the CUSTOMER table
and the REP table
• Repeating groups
– Multiple entries in an individual location
©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as
permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a
license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
10
Entities, Attributes, and
Relationships (continued)
Figure 2-2 Table with repeating groups
©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as
permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
11
Entities, Attributes, and
Relationships (continued)
Figure 2-3 ORDERS table without repeating groups
©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted
in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
12
Entities, Attributes, and
Relationships (continued)
• Relation is a two-dimensional table
– Entries in the table are single-valued
– Each column has a distinct name
– All values in a column are values of the same
attribute
– The order of the columns is immaterial
– Each row is distinct
– The order of the rows is immaterial
13
Entities, Attributes, and
Relationships (continued)
• Use shorthand representation to show
tables and columns
REP (REP_NUM, LAST_NAME, FIRST_NAME, STREET,
CITY, STATE, POSTAL_CODE, COMMISSION, RATE)
CUSTOMER (CUSTOMER_NUM, CUSTOMER_NAME,
STREET, CITY, STATE, POSTAL_CODE, BALANCE,
CREDIT_LIMIT, REP_NUM)
ORDERS (ORDER_NUM, ORDER_DATE, CUSTOMER_NUM)
ORDER_LINE (ORDER_NUM, ITEM_NUM, NUM_ORDERED,
QUOTED_PRICE)
ITEM (ITEM_NUM, DESCRIPTION, ON_HAND, CATEGORY,
STOREHOUSE, PRICE)
©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as
permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
14
Functional Dependence
• An attribute, B, is functionally dependent
on another attribute (or collection), A, if a
value for A determines a single value for B
at any one time
• B is functionally dependent on A
• A B
• A functionally determines B
• Cannot determine from sample data; must
know the users’ policies
©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as
permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
15
Functional Dependence
(continued)
©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a
license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
Figure 2-4 REP table with a PAY_CLASS column
16
Primary Keys
• Unique identifier for a table
• Column (attribute) A (or a collection of columns)
is the primary key for a table (relation), R, if:
– All columns in R are functionally dependent on A
– No subcollection of the columns in A (assuming that A
is a collection of columns and not just a single
column) also has Property 1
©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as
permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
17
Database Design
• Given a set of requirements that the
database must support
• Requirements gathered through a process
known as systems analysis
©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as
permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a
license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
18
Design Method
1. Read the requirements, identify the entities (objects)
involved, and name the entities
2. Identify the unique identifiers for the entities identified
in step 1
3. Identify the attributes for all the entities
4. Identify the functional dependencies that exist among
the attributes
5. Use the functional dependencies to identify the tables
by placing each attribute with the attribute or minimum
combination of attributes on which it is functionally
dependent
6. Identify any relationships between tables.
19
Database Design Requirements
• For TAL Distributors
– Must store data about sales reps, customers,
items, orders, and order lines
– Must enforce certain constraints; for example:
• There is only customer per order
• On a given order, there is at most one line item for
a given item
• The quoted price may differ from the actual price
©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as
permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
20
Database Design Process Example
• Apply requirements to six steps in design
method
©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as
permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
21
Normalization
• Identify the existence of potential
problems
• Provides a method for correcting problems
• Goal
– Convert unnormalized relations (tables that
contain repeating groups) into various types
of normal forms
©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as
permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
22
Normalization (continued)
• 1 NF
– Better than unnormalized
• 2 NF
– Better than 1 NF
• 3 NF
– Better than 2 NF
©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as
permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
23
First Normal Form
• A relation is in first normal form (1NF) if it
does not contain any repeating groups
• To convert an unnormalized relation to
1NF, expand the PK to include the PK of
the repeating group
– This effectively eliminates the repeating group
from the relation
©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as
permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted
in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
24
First Normal Form (continued)
Figure 2-7 Unnormalized order data
First Normal Form (continued)
25©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as
permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
Figure 2-8 Order data converted to first normal form
26
Second Normal Form
• Redundancy causes problems
• Update Anomalies
– Update
– Inconsistent data
– Additions
– Deletions
©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as
permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
Second Normal Form (continued)
27©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as
permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
Table is in First Normal Form but not in Second Normal Form
28
Second Normal Form (continued)
• A relation is in second normal form (2NF)
if it is in 1NF and no nonkey attribute is
dependent on only a portion of the primary
key
or …
• All nonkey attributes are functionally
dependent on the entire primary key
©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as
permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
29
Second Normal Form (continued)
• A 1NF relation with a primary key that is a
single field is in 2NF automatically
©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as
permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
Second Normal Form (continued)
30©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as
permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
Figure 2-10 ORDERS table converted to second normal form
31
Third Normal Form
• Update anomalies still possible
• Determinant
– An attribute (or collection) that functionally
determines another attribute
©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as
permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
Third Normal Form (continued)
32©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as
permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
Table is in Second Normal Form but not in Third Normal Form
33
Third Normal Form (continued)
• A relation is in third normal form (3NF) if it
is in 2NF and the only determinants it
contains are candidate keys
• Boyce-Codd normal form (BCNF) is the
true name for this version of 3NF
©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as
permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
Third Normal Form (continued)
34©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as
permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
Figure 2-12 CUSTOMER table converted to third normal form
35
Diagrams for Database Design
• Graphical illustration
• Entity-relationship (E-R) diagram
– Rectangles represent entities
– Arrows represent relationships
©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as
permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
Diagrams for Database Design
(continued)
36©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as
permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
Figure 2-13 E-R diagram for the TAL Distributors database with rectangles and arrows
Diagrams for Database Design
(continued)
37©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as
permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
Figure 2-14 E-R diagram for the TAL Distributors database with a crow’s foot
Diagrams for Database Design
(continued)
38©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as
permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
Figure 2-15 E-R diagram for the TAL Distributors database with named relationships
39
Summary
• Definition of entity
• Definition of attribute
• Definition of relationship
• Definition of relation
• Definition of functional dependence
• Definition of primary key
• Database design method
©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as
permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
40
Summary (continued)
• Normalization
• Unnormalized (repeating groups)
• First normal form (INF)
• Second normal form (2NF)
• Third normal form (3NF)
• Entity-relationship diagram (E-R diagram)
©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as
permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.

Contenu connexe

Similaire à Sql9e ppt ch02

Coronel_DatabaseSystems_13e_ch02.pptx
Coronel_DatabaseSystems_13e_ch02.pptxCoronel_DatabaseSystems_13e_ch02.pptx
Coronel_DatabaseSystems_13e_ch02.pptxrmzx1989
 
9781337102087 ppt ch16
9781337102087 ppt ch169781337102087 ppt ch16
9781337102087 ppt ch16Terry Yoast
 
Excel module 1 ppt presentation
Excel module 1 ppt presentationExcel module 1 ppt presentation
Excel module 1 ppt presentationdgdotson
 
Access 2016 module 2 ppt presentation
Access 2016 module 2 ppt presentationAccess 2016 module 2 ppt presentation
Access 2016 module 2 ppt presentationdgdotson
 
Access 2016 module 1 ppt presentation
Access 2016 module 1 ppt presentationAccess 2016 module 1 ppt presentation
Access 2016 module 1 ppt presentationdgdotson
 
Intro to Web Design 6e Chapter 7
Intro to Web Design 6e Chapter 7Intro to Web Design 6e Chapter 7
Intro to Web Design 6e Chapter 7Steve Guinan
 
9781337102087 ppt ch08
9781337102087 ppt ch089781337102087 ppt ch08
9781337102087 ppt ch08Terry Yoast
 
9781337102087 ppt ch13
9781337102087 ppt ch139781337102087 ppt ch13
9781337102087 ppt ch13Terry Yoast
 
Excel module 2 ppt presentation
Excel module 2 ppt presentationExcel module 2 ppt presentation
Excel module 2 ppt presentationdgdotson
 
9781337102087 ppt ch12
9781337102087 ppt ch129781337102087 ppt ch12
9781337102087 ppt ch12Terry Yoast
 
Intro to Web Design 6e Chapter 4
Intro to Web Design 6e Chapter 4 Intro to Web Design 6e Chapter 4
Intro to Web Design 6e Chapter 4 Steve Guinan
 
9781337102087 ppt ch09
9781337102087 ppt ch099781337102087 ppt ch09
9781337102087 ppt ch09Terry Yoast
 
Access 2016 module 4 ppt presentation
Access 2016 module 4 ppt presentationAccess 2016 module 4 ppt presentation
Access 2016 module 4 ppt presentationdgdotson
 
9781337102087 ppt ch06
9781337102087 ppt ch069781337102087 ppt ch06
9781337102087 ppt ch06Terry Yoast
 
Non-functional requirements
Non-functional requirements Non-functional requirements
Non-functional requirements Rohela Raouf
 
Data Structures and CAATTs for Data Extraction
Data Structures and CAATTs for Data ExtractionData Structures and CAATTs for Data Extraction
Data Structures and CAATTs for Data Extraction204025
 
Hitt_ppt_12e_ch03_SM.pptx
Hitt_ppt_12e_ch03_SM.pptxHitt_ppt_12e_ch03_SM.pptx
Hitt_ppt_12e_ch03_SM.pptxmubasherakram1
 
9781337102087 ppt ch10
9781337102087 ppt ch109781337102087 ppt ch10
9781337102087 ppt ch10Terry Yoast
 
Debate Initial Post and Response Rubric Student Name .docx
Debate Initial Post and Response Rubric Student Name     .docxDebate Initial Post and Response Rubric Student Name     .docx
Debate Initial Post and Response Rubric Student Name .docxsimonithomas47935
 
New Perspectives on Microsoft Access 2016Module 4Creating.docx
New Perspectives on Microsoft Access 2016Module 4Creating.docxNew Perspectives on Microsoft Access 2016Module 4Creating.docx
New Perspectives on Microsoft Access 2016Module 4Creating.docxgibbonshay
 

Similaire à Sql9e ppt ch02 (20)

Coronel_DatabaseSystems_13e_ch02.pptx
Coronel_DatabaseSystems_13e_ch02.pptxCoronel_DatabaseSystems_13e_ch02.pptx
Coronel_DatabaseSystems_13e_ch02.pptx
 
9781337102087 ppt ch16
9781337102087 ppt ch169781337102087 ppt ch16
9781337102087 ppt ch16
 
Excel module 1 ppt presentation
Excel module 1 ppt presentationExcel module 1 ppt presentation
Excel module 1 ppt presentation
 
Access 2016 module 2 ppt presentation
Access 2016 module 2 ppt presentationAccess 2016 module 2 ppt presentation
Access 2016 module 2 ppt presentation
 
Access 2016 module 1 ppt presentation
Access 2016 module 1 ppt presentationAccess 2016 module 1 ppt presentation
Access 2016 module 1 ppt presentation
 
Intro to Web Design 6e Chapter 7
Intro to Web Design 6e Chapter 7Intro to Web Design 6e Chapter 7
Intro to Web Design 6e Chapter 7
 
9781337102087 ppt ch08
9781337102087 ppt ch089781337102087 ppt ch08
9781337102087 ppt ch08
 
9781337102087 ppt ch13
9781337102087 ppt ch139781337102087 ppt ch13
9781337102087 ppt ch13
 
Excel module 2 ppt presentation
Excel module 2 ppt presentationExcel module 2 ppt presentation
Excel module 2 ppt presentation
 
9781337102087 ppt ch12
9781337102087 ppt ch129781337102087 ppt ch12
9781337102087 ppt ch12
 
Intro to Web Design 6e Chapter 4
Intro to Web Design 6e Chapter 4 Intro to Web Design 6e Chapter 4
Intro to Web Design 6e Chapter 4
 
9781337102087 ppt ch09
9781337102087 ppt ch099781337102087 ppt ch09
9781337102087 ppt ch09
 
Access 2016 module 4 ppt presentation
Access 2016 module 4 ppt presentationAccess 2016 module 4 ppt presentation
Access 2016 module 4 ppt presentation
 
9781337102087 ppt ch06
9781337102087 ppt ch069781337102087 ppt ch06
9781337102087 ppt ch06
 
Non-functional requirements
Non-functional requirements Non-functional requirements
Non-functional requirements
 
Data Structures and CAATTs for Data Extraction
Data Structures and CAATTs for Data ExtractionData Structures and CAATTs for Data Extraction
Data Structures and CAATTs for Data Extraction
 
Hitt_ppt_12e_ch03_SM.pptx
Hitt_ppt_12e_ch03_SM.pptxHitt_ppt_12e_ch03_SM.pptx
Hitt_ppt_12e_ch03_SM.pptx
 
9781337102087 ppt ch10
9781337102087 ppt ch109781337102087 ppt ch10
9781337102087 ppt ch10
 
Debate Initial Post and Response Rubric Student Name .docx
Debate Initial Post and Response Rubric Student Name     .docxDebate Initial Post and Response Rubric Student Name     .docx
Debate Initial Post and Response Rubric Student Name .docx
 
New Perspectives on Microsoft Access 2016Module 4Creating.docx
New Perspectives on Microsoft Access 2016Module 4Creating.docxNew Perspectives on Microsoft Access 2016Module 4Creating.docx
New Perspectives on Microsoft Access 2016Module 4Creating.docx
 

Plus de Dr. Ahmed Al Zaidy

Chapter 14 Exploring Object-based Programming
Chapter 14 Exploring Object-based ProgrammingChapter 14 Exploring Object-based Programming
Chapter 14 Exploring Object-based ProgrammingDr. Ahmed Al Zaidy
 
Chapter 13 Programming for web forms
Chapter 13 Programming for web formsChapter 13 Programming for web forms
Chapter 13 Programming for web formsDr. Ahmed Al Zaidy
 
Chapter 12 Working with Document nodes and style sheets
Chapter 12 Working with Document nodes and style sheetsChapter 12 Working with Document nodes and style sheets
Chapter 12 Working with Document nodes and style sheetsDr. Ahmed Al Zaidy
 
Chapter 11 Working with Events and Styles
Chapter 11 Working with Events and StylesChapter 11 Working with Events and Styles
Chapter 11 Working with Events and StylesDr. Ahmed Al Zaidy
 
Chapter 10 Exploring arrays, loops, and conditional statements
Chapter 10 Exploring arrays, loops, and conditional statementsChapter 10 Exploring arrays, loops, and conditional statements
Chapter 10 Exploring arrays, loops, and conditional statementsDr. Ahmed Al Zaidy
 
Chapter 9 Getting Started with JavaScript
Chapter 9 Getting Started with JavaScriptChapter 9 Getting Started with JavaScript
Chapter 9 Getting Started with JavaScriptDr. Ahmed Al Zaidy
 
Chapter 8 Enhancing a website with multimedia
Chapter 8 Enhancing a website with multimediaChapter 8 Enhancing a website with multimedia
Chapter 8 Enhancing a website with multimediaDr. Ahmed Al Zaidy
 
Chapter 7 Designing a web form
Chapter 7 Designing a web formChapter 7 Designing a web form
Chapter 7 Designing a web formDr. Ahmed Al Zaidy
 
Chapter 6 Working with Tables and Columns
Chapter 6 Working with Tables and ColumnsChapter 6 Working with Tables and Columns
Chapter 6 Working with Tables and ColumnsDr. Ahmed Al Zaidy
 
Chapter 5 Designing for the mobile web
Chapter 5 Designing for the mobile webChapter 5 Designing for the mobile web
Chapter 5 Designing for the mobile webDr. Ahmed Al Zaidy
 
Chapter 4 Graphic Design with CSS
Chapter 4 Graphic Design with CSSChapter 4 Graphic Design with CSS
Chapter 4 Graphic Design with CSSDr. Ahmed Al Zaidy
 
Chapter 3 Designing a Page Layout
Chapter 3 Designing a Page LayoutChapter 3 Designing a Page Layout
Chapter 3 Designing a Page LayoutDr. Ahmed Al Zaidy
 
Chapter 2 Getting Started with CSS
Chapter 2 Getting Started with CSSChapter 2 Getting Started with CSS
Chapter 2 Getting Started with CSSDr. Ahmed Al Zaidy
 
Chapter 1 Getting Started with HTML5
Chapter 1 Getting Started with HTML5Chapter 1 Getting Started with HTML5
Chapter 1 Getting Started with HTML5Dr. Ahmed Al Zaidy
 
testing throughout-the-software-life-cycle-section-2
testing throughout-the-software-life-cycle-section-2testing throughout-the-software-life-cycle-section-2
testing throughout-the-software-life-cycle-section-2Dr. Ahmed Al Zaidy
 
Chapter 14 Business Continuity
Chapter 14 Business ContinuityChapter 14 Business Continuity
Chapter 14 Business ContinuityDr. Ahmed Al Zaidy
 
Chapter 13 Vulnerability Assessment and Data Security
Chapter 13 Vulnerability Assessment and Data SecurityChapter 13 Vulnerability Assessment and Data Security
Chapter 13 Vulnerability Assessment and Data SecurityDr. Ahmed Al Zaidy
 

Plus de Dr. Ahmed Al Zaidy (20)

Chapter 14 Exploring Object-based Programming
Chapter 14 Exploring Object-based ProgrammingChapter 14 Exploring Object-based Programming
Chapter 14 Exploring Object-based Programming
 
Chapter 13 Programming for web forms
Chapter 13 Programming for web formsChapter 13 Programming for web forms
Chapter 13 Programming for web forms
 
Chapter 12 Working with Document nodes and style sheets
Chapter 12 Working with Document nodes and style sheetsChapter 12 Working with Document nodes and style sheets
Chapter 12 Working with Document nodes and style sheets
 
Chapter 11 Working with Events and Styles
Chapter 11 Working with Events and StylesChapter 11 Working with Events and Styles
Chapter 11 Working with Events and Styles
 
Chapter 10 Exploring arrays, loops, and conditional statements
Chapter 10 Exploring arrays, loops, and conditional statementsChapter 10 Exploring arrays, loops, and conditional statements
Chapter 10 Exploring arrays, loops, and conditional statements
 
Chapter 9 Getting Started with JavaScript
Chapter 9 Getting Started with JavaScriptChapter 9 Getting Started with JavaScript
Chapter 9 Getting Started with JavaScript
 
Chapter 8 Enhancing a website with multimedia
Chapter 8 Enhancing a website with multimediaChapter 8 Enhancing a website with multimedia
Chapter 8 Enhancing a website with multimedia
 
Chapter 7 Designing a web form
Chapter 7 Designing a web formChapter 7 Designing a web form
Chapter 7 Designing a web form
 
Chapter 6 Working with Tables and Columns
Chapter 6 Working with Tables and ColumnsChapter 6 Working with Tables and Columns
Chapter 6 Working with Tables and Columns
 
Chapter 5 Designing for the mobile web
Chapter 5 Designing for the mobile webChapter 5 Designing for the mobile web
Chapter 5 Designing for the mobile web
 
Chapter 4 Graphic Design with CSS
Chapter 4 Graphic Design with CSSChapter 4 Graphic Design with CSS
Chapter 4 Graphic Design with CSS
 
Chapter 3 Designing a Page Layout
Chapter 3 Designing a Page LayoutChapter 3 Designing a Page Layout
Chapter 3 Designing a Page Layout
 
Chapter 2 Getting Started with CSS
Chapter 2 Getting Started with CSSChapter 2 Getting Started with CSS
Chapter 2 Getting Started with CSS
 
Chapter 1 Getting Started with HTML5
Chapter 1 Getting Started with HTML5Chapter 1 Getting Started with HTML5
Chapter 1 Getting Started with HTML5
 
Integer overflows
Integer overflowsInteger overflows
Integer overflows
 
testing throughout-the-software-life-cycle-section-2
testing throughout-the-software-life-cycle-section-2testing throughout-the-software-life-cycle-section-2
testing throughout-the-software-life-cycle-section-2
 
Fundamental of testing
Fundamental of testingFundamental of testing
Fundamental of testing
 
Chapter 15 Risk Mitigation
Chapter 15 Risk MitigationChapter 15 Risk Mitigation
Chapter 15 Risk Mitigation
 
Chapter 14 Business Continuity
Chapter 14 Business ContinuityChapter 14 Business Continuity
Chapter 14 Business Continuity
 
Chapter 13 Vulnerability Assessment and Data Security
Chapter 13 Vulnerability Assessment and Data SecurityChapter 13 Vulnerability Assessment and Data Security
Chapter 13 Vulnerability Assessment and Data Security
 

Dernier

ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural ResourcesEnergy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural ResourcesShubhangi Sonawane
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...Poonam Aher Patil
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxVishalSingh1417
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701bronxfugly43
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docxPoojaSen20
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxnegromaestrong
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfAyushMahapatra5
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 

Dernier (20)

ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural ResourcesEnergy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 

Sql9e ppt ch02

  • 1. A Guide to SQL, Ninth Edition Chapter Two Database Design Fundamentals
  • 2. 2 Objectives • Understand the terms entity, attribute, and relationship • Understand the terms relation and relational database • Understand functional dependence and be able to identify when one column is functionally dependent on another • Understand the term primary key and identify primary keys in tables ©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
  • 3. 3 Objectives (continued) • Design a database to satisfy a set of requirements • Convert an unnormalized relation to first normal form • Convert tables from first normal form to second normal form • Convert tables from second normal form to third normal form ©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
  • 4. 4 Objectives (continued) • Create an entity-relationship diagram to represent the design of a database ©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
  • 5. 5 Introduction • Database design – Process of determining the particular tables and columns that will comprise a database • Must understand database concepts • Process of normalization ©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
  • 6. 6 Database Concepts • Entity • Attribute • Relationship • Functional dependence • Primary key ©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
  • 7. 7 Relational Database • A collection of tables • Tables in TAL Distributors Database – Rep – Customer – Orders – Item – Order_Line ©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
  • 8. 8 Entities, Attributes, and Relationships • Entity (like a noun) – A person, place, thing, or event • Attribute (like an adjective or adverb) – Property of an entity • Relationship – Association between entities ©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
  • 9. 9 Entities, Attributes, and Relationships (continued) • One-to-many relationship – One rep is related to many customers – Implement by having a common column in two or more tables • REP_NUM is a column in the CUSTOMER table and the REP table • Repeating groups – Multiple entries in an individual location ©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
  • 10. ©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 10 Entities, Attributes, and Relationships (continued) Figure 2-2 Table with repeating groups
  • 11. ©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 11 Entities, Attributes, and Relationships (continued) Figure 2-3 ORDERS table without repeating groups
  • 12. ©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 12 Entities, Attributes, and Relationships (continued) • Relation is a two-dimensional table – Entries in the table are single-valued – Each column has a distinct name – All values in a column are values of the same attribute – The order of the columns is immaterial – Each row is distinct – The order of the rows is immaterial
  • 13. 13 Entities, Attributes, and Relationships (continued) • Use shorthand representation to show tables and columns REP (REP_NUM, LAST_NAME, FIRST_NAME, STREET, CITY, STATE, POSTAL_CODE, COMMISSION, RATE) CUSTOMER (CUSTOMER_NUM, CUSTOMER_NAME, STREET, CITY, STATE, POSTAL_CODE, BALANCE, CREDIT_LIMIT, REP_NUM) ORDERS (ORDER_NUM, ORDER_DATE, CUSTOMER_NUM) ORDER_LINE (ORDER_NUM, ITEM_NUM, NUM_ORDERED, QUOTED_PRICE) ITEM (ITEM_NUM, DESCRIPTION, ON_HAND, CATEGORY, STOREHOUSE, PRICE) ©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
  • 14. 14 Functional Dependence • An attribute, B, is functionally dependent on another attribute (or collection), A, if a value for A determines a single value for B at any one time • B is functionally dependent on A • A B • A functionally determines B • Cannot determine from sample data; must know the users’ policies ©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
  • 15. 15 Functional Dependence (continued) ©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. Figure 2-4 REP table with a PAY_CLASS column
  • 16. 16 Primary Keys • Unique identifier for a table • Column (attribute) A (or a collection of columns) is the primary key for a table (relation), R, if: – All columns in R are functionally dependent on A – No subcollection of the columns in A (assuming that A is a collection of columns and not just a single column) also has Property 1 ©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
  • 17. 17 Database Design • Given a set of requirements that the database must support • Requirements gathered through a process known as systems analysis ©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
  • 18. ©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 18 Design Method 1. Read the requirements, identify the entities (objects) involved, and name the entities 2. Identify the unique identifiers for the entities identified in step 1 3. Identify the attributes for all the entities 4. Identify the functional dependencies that exist among the attributes 5. Use the functional dependencies to identify the tables by placing each attribute with the attribute or minimum combination of attributes on which it is functionally dependent 6. Identify any relationships between tables.
  • 19. 19 Database Design Requirements • For TAL Distributors – Must store data about sales reps, customers, items, orders, and order lines – Must enforce certain constraints; for example: • There is only customer per order • On a given order, there is at most one line item for a given item • The quoted price may differ from the actual price ©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
  • 20. 20 Database Design Process Example • Apply requirements to six steps in design method ©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
  • 21. 21 Normalization • Identify the existence of potential problems • Provides a method for correcting problems • Goal – Convert unnormalized relations (tables that contain repeating groups) into various types of normal forms ©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
  • 22. 22 Normalization (continued) • 1 NF – Better than unnormalized • 2 NF – Better than 1 NF • 3 NF – Better than 2 NF ©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
  • 23. 23 First Normal Form • A relation is in first normal form (1NF) if it does not contain any repeating groups • To convert an unnormalized relation to 1NF, expand the PK to include the PK of the repeating group – This effectively eliminates the repeating group from the relation ©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
  • 24. ©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 24 First Normal Form (continued) Figure 2-7 Unnormalized order data
  • 25. First Normal Form (continued) 25©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. Figure 2-8 Order data converted to first normal form
  • 26. 26 Second Normal Form • Redundancy causes problems • Update Anomalies – Update – Inconsistent data – Additions – Deletions ©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
  • 27. Second Normal Form (continued) 27©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. Table is in First Normal Form but not in Second Normal Form
  • 28. 28 Second Normal Form (continued) • A relation is in second normal form (2NF) if it is in 1NF and no nonkey attribute is dependent on only a portion of the primary key or … • All nonkey attributes are functionally dependent on the entire primary key ©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
  • 29. 29 Second Normal Form (continued) • A 1NF relation with a primary key that is a single field is in 2NF automatically ©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
  • 30. Second Normal Form (continued) 30©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. Figure 2-10 ORDERS table converted to second normal form
  • 31. 31 Third Normal Form • Update anomalies still possible • Determinant – An attribute (or collection) that functionally determines another attribute ©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
  • 32. Third Normal Form (continued) 32©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. Table is in Second Normal Form but not in Third Normal Form
  • 33. 33 Third Normal Form (continued) • A relation is in third normal form (3NF) if it is in 2NF and the only determinants it contains are candidate keys • Boyce-Codd normal form (BCNF) is the true name for this version of 3NF ©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
  • 34. Third Normal Form (continued) 34©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. Figure 2-12 CUSTOMER table converted to third normal form
  • 35. 35 Diagrams for Database Design • Graphical illustration • Entity-relationship (E-R) diagram – Rectangles represent entities – Arrows represent relationships ©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
  • 36. Diagrams for Database Design (continued) 36©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. Figure 2-13 E-R diagram for the TAL Distributors database with rectangles and arrows
  • 37. Diagrams for Database Design (continued) 37©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. Figure 2-14 E-R diagram for the TAL Distributors database with a crow’s foot
  • 38. Diagrams for Database Design (continued) 38©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. Figure 2-15 E-R diagram for the TAL Distributors database with named relationships
  • 39. 39 Summary • Definition of entity • Definition of attribute • Definition of relationship • Definition of relation • Definition of functional dependence • Definition of primary key • Database design method ©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
  • 40. 40 Summary (continued) • Normalization • Unnormalized (repeating groups) • First normal form (INF) • Second normal form (2NF) • Third normal form (3NF) • Entity-relationship diagram (E-R diagram) ©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.