《数据库处理——基础、设计与实现(第十版)》第三章

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

3-18
Functional Dependencies in the SKU_DATA Table
SKU (SKU_Description, Department, Buyer) (SKU, Department, Buyer)
SKU_Description Buyer
Department
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall
– – – – – – – – Rows contain data about an entity Columns contain data about attributes of the entity All entries in a column are of the same kind Each column has a unique name Cells of the table hold a single value The order of the columns is unimportant The order of the rows is unimportant No two rows may be identical
StudentID StudentID StudentName (DormName, DormRoom, Fee)
• The attribute on the left side of the functional dependency is called the determinant • Functional dependencies may be based on equations:
• • • • • • • • • • • • Entity Relation Functional Dependency Determinant Candidate Key Composite Key Primary Key Surrogate Key Foreign Key Referential integrity constraint Normal Form Multivalued Dependency
Functional Dependencies Are Not Equations
ObjectColor ObjectColor ObjectColor
Weight Shape (Weight, Shape)
3-15
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 3-3
But first • We need to understand:
– The relational model – Relational model terminology
3-19
Functional Dependencies in the ORDER_ITEM Table
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall
3-20
Functional Dependencies in the ORDER_ITEM Table
3-12
Alternative Terminology
• Although not all tables are relations, the terms table and relation are normally used interchangeably • The following sets of terms are equivalent:
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall
3-11
Tables That Are Not Relations: Table with Required Row Order
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall
3-17
Functional Dependencies in the SKU_DATA Table
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall
ExtendedPrice = Quantity X UnitPrice (Quantity, UnitPrice) ExtendedPrice
• Function dependencies are not equations!
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 3-14
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall
3-13
Functional Dependency
• A functional dependency occurs when the value of one (a set of) attribute(s) determines the value of a second (set of) attribute(s):
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall
3-16
Functional Dependency Rules
• If A (B, C), then A B and A C • If (A,B) C, then neither A nor B determines C by itself
• Now the standard model for commercial DBMS products
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall
3-5
Important Relational Model Terms
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall
3-4
The Relational Model
• Introduced in 1970 • Created by E.F. Codd
– He was an IBM engineer – The model used mathematics known as “relational algebra”
(OrderNumber, SKU) (Quantity, Price, ExtendedPrice) (Quantity, Price) (ExtendedPrice)
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall
3-21
What Makes Determinant Values Unique? • A determinant is unique in a relation if, and only if, it determines every other column in the relation • You cannot find the determinants of all functional dependencies simply by looking for unique values in one column:
Composite Determinants
• Composite determinant: A determinant of a functional dependency that consists of more than one attribute
(StudentName, ClassName) (Grade)
David M. Kroenke’s
Database Processing:
Fundamentals, Design, and Implementation
Chapter Three: The Relational Model and Normalization
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 3-1
DAVID M. KROENKE’S DATABASE PROCESSINБайду номын сангаас, 10th Edition © 2006 Pearson Prentice Hall
3-2
How Many Tables?
Should we store these two tables as they are, or should we combine them into one table in our new database?
– Customers – Computers – Sales
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall
3-7
Relation
• Relational DBMS products store data about entities in relations, which are a special type of table • A relation is a two-dimensional table that has the following characteristics:
3-9
A Relation with Values of Varying Length
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall
3-10
Tables That Are Not Relations: Multiple Entries per Cell
Chapter Premise
• We have received one or more tables of existing data • The data is to be stored in a new database • QUESTION: Should the data be stored as received, or should it be transformed for storage?
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall
3-8
A Relation
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall
3-6
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall
Entity
• An entity is some identifiable thing that users want to track:
相关文档
最新文档