Database Design Methodology (1)
Database Design Methodology (1)
REFERENCE TEXT:
CHA PT ER 0 3 , 04: DATABA SE SYST EMS: DES I GN, I M P L EM ENTATIO N, A N D
M A N AGEMENT
Coronel, Carlos and Morris, Steven, Database Systems: Design, Implementation, and Management, 14 Edition. © 2023 Cengage. All Rights Reserved. May
not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Learning Objectives
1. Describe the relational database model’s logical structure.
2. Identify the relational model’s basic components and explain the structure,
contents, and characteristics of a relational table.
3. Identify appropriate entities and then the relationships among the entities in the
relational database model.
The relational model enables you to view data logically rather than physically.
Keys are important because they are used to ensure that each row in a table is
uniquely identifiable.
◦ They are also used to establish relationships among tables and to ensure the
integrity of the data
Dependencies
The role of a key is based on the concept of determination, which is the state in which
knowing the value of one attribute helps to determine the value of another
◦ Example: revenue – cost = profit
Functional dependence means that the value of one or more attributes determines the
value of one or more other attributes
The attribute whose value determines another is called the determinant or the key
The attribute whose value is determined by the other is called the dependent
Full functional dependence is used to refer to functional dependencies in which the
entire collection of attributes in the determinant is necessary for the relationship
Types of Keys (1)
A composite key is a key that is composed of more than one attribute
An attribute that is part of a key is called a key attribute
A super key is a key that can uniquely identify any row in the table
A candidate key is a minimal superkey; that is, a key that does not contain a subset of
attributes that is itself a superkey
Entity integrity is the condition in which each row in the table has its own known, unique
identity
A null is the absence of any data value, and it is never allowed in any part of a primary key
Types of Keys (2 )
A null could represent any of the following:
◦ An unknown attribute value
◦ A known, but missing, attribute value
◦ A “not applicable” condition
A foreign key (FK) is a primary key of one table that has been placed in another
table
Referential integrity is a condition by which a dependent table’s foreign key
entry must have either a null entry or a matching entry in the primary key of the
related table
A secondary key is a key that is used strictly for data retrieval purposes and does
not require a functional dependency
Types of Keys (3)
Requirement All primary key entries are unique, and no part of a primary key may be null.
Purpose Each row will have a known, unique identity, and foreign key values can properly reference primary key values.
Example No invoice can have a duplicate number, nor can it be null; in short, all invoices are uniquely identified by their invoice number.
Requirement A foreign key may have either a null entry, as long as it’s not part of its table’s primary key, or an entry that matches the primary
key value in a table to which it is related (every non-null foreign key value must reference an existing primary key value).
Purpose The purpose is to ensure that every reference by a foreign key is a valid reference to the related primary key. It is possible for an
attribute not to have a corresponding value, but it will be impossible to have an invalid entry; the enforcement of the referential
integrity rule makes it impossible to delete a row in one table whose primary key has mandatory matching foreign key values in
another table.
Example A customer might not yet have an assigned sales representative (number), but it will be impossible to have an invalid sales
representative (number).
Integrity Rules (2 )
In the one-to-one (1:1) relationship, one entity can be related to only one other entity
and vice versa
3. Super Key
8. Entity Integrity
4. Referential Integrity
9. Data Redundancy
5. Foreign Key
10. Candidate Key
Review Questions
1. What is the difference between a table and a database ?
6. Give an example of a M:M relationship and then break into down into 1:M relationships.