0% found this document useful (0 votes)
5 views

Database Design Methodology (1)

The document outlines the principles of database design methodology, focusing on the relational database model's structure, components, and integrity rules. It explains key concepts such as tables, keys, functional dependencies, and relationships among entities, emphasizing the importance of entity and referential integrity. Additionally, it addresses data redundancy and provides examples of different types of relationships, including one-to-many and many-to-many.

Uploaded by

danm29309
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Database Design Methodology (1)

The document outlines the principles of database design methodology, focusing on the relational database model's structure, components, and integrity rules. It explains key concepts such as tables, keys, functional dependencies, and relationships among entities, emphasizing the importance of entity and referential integrity. Additionally, it addresses data redundancy and provides examples of different types of relationships, including one-to-many and many-to-many.

Uploaded by

danm29309
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20

DBS101

Database Design Methodology

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.

4. Describe how data redundancy is handled in the relational database model.


Relational Data Model
The relational data model allows the designer to focus on the logical
representation of the data and its relationships, rather than on the physical
storage details.

The relational model enables you to view data logically rather than physically.

Logical simplicity tends to yield simple and effective database design


methodologies.
Tables and Their Characteristics (1 )
A table is perceived as a two-dimensional structure composed of rows and columns.

A table is also called a relation.

You can think of a table as a persistent representation of a logical relation.


◦ A relation whose contents can be permanently saved for future use.

The domain is the set of allowable values for an attribute.

The primary key (PK) is an attribute or combination of attributes that uniquely


identifies any given row.
Tables and Their Characteristics (2 )
Table 3.1 Characteristics of a Relational Table
1 A table is perceived as a two-dimensional structure composed of rows and columns
2 Each table row (tuple) represents a single entity occurrence within the entity set
3 Each table column represents an attribute, and each column has a distinct name
4 Each intersection of a row and column represents a single data value
5 All values in a column must conform to the same data format
6 Each column has a specific range of values known as the attribute domain
7 The order of the rows and columns is immaterial to the DBMS
8 Each table must have an attribute or combination of attributes that uniquely identifies each row
Keys
A key consists of one or more attributes that determine other attributes.

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)

Figure 3.2 An Example of a Simple


Relational Database
Integrity Rules (1)

Table 3.4 Integrity Rules

Entity Integrity Description

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.

Referential Integrity Description

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 )

Figure 3.3 An Illustration of Integrity


Rules
Relationships within the Relational
Database (1 )
The one-to-many (1:M) relationship is the norm for relational databases

In the one-to-one (1:1) relationship, one entity can be related to only one other entity
and vice versa

The many-to-many (M:N) relationship can be implemented by creating a new entity in


1:M relationships with the original entities
◦ A composite entity (i.e., bridge or associative entity) helps avoid problems inherent
to M:N relationships
◦ It includes the primary keys of tables to be linked
Relationships within the Relational
Database (2)
Figure 3.19 The 1:M Relationship between COURSE and CLASS

Figure 3.20 The Implemented 1:M


Relationship between COURSE and CLASS
Relationships within the Relational
Database (3)

There are 2 different types of


relationships between department &
employee.
Figure 3.21 The 1:1 Relationship 1.Many professors are working in each
between PROFESSOR and DEPARTMENT department, but every professor can
work only in one department 1-M.
2. Every department is chaired by only
one professor and every professor can
chair at most one department which is
1-1

Figure 3.22 The Implemented 1:1


Relationship between PROFESSOR and
DEPARTMENT
Relationships within the Relational
Database (4)
Figure 3.23 The ERM’s M:N Relationship between STUDENT and
CLASS

Figure 3.24 The Wrong


Implementation of the M:N
Relationship between STUDENT and
CLASS
Relationships within the Relational
Database (5)
Figure 3.25 Converting the M:N
Relationship into Two 1:M Relationships

Because the ENROLL table links two tables,


it is also called a linking table

Figure 3.26 Changing the M:N


Relationships to Two 1:M
Relationships
Relationships within the Relational
Database (6)
Figure 3.27 The Expanded ER Model

Figure 3.28 The Relational


Diagram for the
Ch03_TinyCollege Database
Key Terms
1. Functional Dependency 6. Null

2. Primary Key 7. Tuple

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 ?

2. Why are entity integrity and referential integrity important in a database?

3. What is the difference between a primary key and a candidate key ?

4. What is a bridge table and when it is needed ?

5. Give an example of a 1:M relationship.

6. Give an example of a M:M relationship and then break into down into 1:M relationships.

You might also like