Database Design - Summerize ch1-11
Database Design - Summerize ch1-11
1. What Is a Database?
o A database is an organized collection of data used for modeling an
organization or a process.
o Types of Databases:
Operational Databases: Used for online transaction processing
(OLTP). They handle dynamic data that changes constantly (e.g., retail
stores and hospitals).
Analytical Databases: Used for online analytical processing (OLAP).
These store static, historical data for trends and strategic projections
(e.g., marketing firms).
2. The Relational Database:
o Developed in 1969 by Dr. Edgar F. Codd.
o Based on set theory and first-order predicate logic.
o Stores data in relations (tables), consisting of tuples (records) and attributes
(fields).
o Data is independent of physical storage, meaning users don't need to know the
physical location of data to retrieve it.
3. Data Relationships:
o Relationships between tables are categorized as:
One-to-One
One-to-Many
Many-to-Many
o Relationships are established through shared fields with matching values.
4. Retrieving Data:
o Data is retrieved using Structured Query Language (SQL).
o Key components of an SQL query:
SELECT…FROM: Specifies the fields and tables.
WHERE: Filters data based on criteria.
ORDER BY: Sorts data in ascending or descending order.
5. Advantages of Relational Databases:
o Built-in Multilevel Integrity:
Ensures accuracy at field, table, relationship, and business levels.
o Logical and Physical Data Independence:
Changes in logical design or physical implementation don’t affect
applications.
o Guaranteed Data Consistency and Accuracy.
o Easy Data Retrieval:
Users can query related or unrelated tables for information.
6. Relational Database Management Systems (RDBMS):
o Software used to create, maintain, and manipulate relational databases.
o Examples: MySQL, Oracle, Microsoft SQL Server, PostgreSQL.
Key Definitions:
Review Questions:
o Poor design results in issues such as redundant data, inefficient queries, and
difficulty in maintenance.
o Key theories include set theory and relational algebra, which form the basis
of the relational database model.
6. Database-Design Methods:
7. Normalization:
o Key Concepts:
4. How does a poor database design affect data integrity and system performance?
Chapter 3: Terminology
This chapter introduces essential terminology for understanding database design. The terms
are grouped into four categories: value-related terms, structure-related terms, relationship-
related terms, and integrity-related terms.
1. Value-Related Terms
Data
Definition: Raw facts collected for analysis or reference. Example: a customer name
or phone number.
Information
Null
Key Points:
Advantages:
o Helps distinguish between "no value" and a deliberately assigned value.
2. Structure-Related Terms
Table
Key Components:
o Columns (also called fields or attributes): Represent specific data points for
each instance.
Field
Attributes: Fields should be atomic, meaning they contain only one value.
Record
View
Definition: A virtual table created by querying data from one or more tables.
Use Case: Simplifies complex queries and restricts access to sensitive data.
Keys
Types:
Index
Trade-off: Speeds up queries but can slow down data modification operations like
insertions or deletions.
3. Relationship-Related Terms
Relationships
Definition: Associations between tables that allow for meaningful data retrieval.
Types:
Types of Participation
Optional Participation: A record in one table may or may not have a corresponding
record in another table.
Degree of Participation
Definition: The number of times a record in one table can be associated with records
in another table.
4. Integrity-Related Terms
Field Specification
Definition: Rules that define the data type, size, format, and constraints for a field.
Data Integrity
Definition: The accuracy, consistency, and reliability of data in a database.
Types:
o Entity Integrity: Ensures that every table has a unique primary key and no
part of the primary key is null.
2. Explain the purpose of null values and describe their advantages and disadvantages.
3. Define the term "primary key" and explain its importance in database design.
This chapter provides a high-level overview of the database design process, explaining how
different components fit together to create a functional and efficient database.
Skipping Steps: Avoid skipping steps in the design process, as it can lead to poor data
structures and operational inefficiencies.
o Example: "To manage and track customer orders for the company."
Mission Objectives: Specific tasks the database must perform to fulfill its mission.
Actions:
o One-to-One (1:1): Each record in one table matches one record in another
table.
Types:
Purpose:
Levels of Integrity:
Focus on aligning the database design with business needs and user requirements.
2. Why is it important to analyze the current database before designing a new one?
4. What are business rules, and why are they essential in database design?
This chapter focuses on the initial steps in the database design process, including defining a
mission statement and mission objectives. It also covers the importance of interviews for
gathering user requirements.
1. Conducting Interviews
Interviews are essential for understanding the organization’s needs, current data
management practices, and requirements for the database.
Types of Participants:
Participant Guidelines
Interviewer Guidelines
Examples:
o "To manage customer and order information for effective tracking and
reporting."
3. Composing Mission Objectives
Definition: Specific tasks the database must accomplish to fulfill the mission
statement.
Examples:
Key Takeaways:
5. Provide an example of a poorly written mission objective and explain how to improve
it.
2. What are the main features of the relational database model? (Page 5-6)
5. What are the common types of relationships in a relational database? (Page 6-7)
8. List the benefits of following a good database design methodology. (Page 23)
10. Explain the key differences between traditional design methods and the
methodology in this book. (Page 24-26)
Chapter 3: Terminology
11. Define data and information. How do they differ? (Page 35)
12. What is a null value, and what problems can it create in a database? (Page 37-39)
13. Describe the following terms: table, field, record, and view. (Page 41-46)
14. What is the purpose of a primary key? How does it differ from a foreign key? (Page
48)
15. Explain the types of relationships (1:1, 1:N, M:N) in relational databases. (Page 52-
57)
16. Why is it important to complete the database design process? (Page 68)
17. What is the purpose of defining a mission statement and mission objectives? (Page
69)
18. What are the key steps in the database design process? (Page 68-75)
19. Explain the role of business rules in database design. (Page 74)
21. Why are interviews important in the database design process? (Page 82)
22. What are the guidelines for conducting effective interviews? (Page 84-86)
23. How do you compose a clear and effective mission statement? (Page 91-93)
24. What are the characteristics of well-written mission objectives? (Page 97)
Purpose:
This chapter focuses on analyzing an existing database to understand its structure, identify
its limitations, and gather the necessary information to design an improved database.
2. Conduct Interviews:
o Evaluate how information is presented (e.g., reports and queries) and ensure
it meets user needs.
o Preliminary Field List: List all the fields currently used in the database.
o Discuss with users and management to ensure fields are comprehensive and
meaningful.
o Collect information on current, additional, and future data needs from both
users and management.
o Identify data that lacks integrity or does not meet organizational needs.
Question 1:
What is the main goal of analyzing the current database?
Answer:
The main goal is to understand the existing database structure, identify limitations, and
gather the necessary information to design a more effective and efficient database.
Question 2:
Why are interviews important during the analysis of the current database?
Answer:
Interviews provide insights into how users and management interact with the database,
uncovering requirements, inefficiencies, and future needs.
Question 3:
What are the two types of field lists created during database analysis?
Answer:
The two types are the Preliminary Field List (fields currently in use) and the Calculated Field
List (fields derived from calculations or reports).
Question 4:
Which aspect of the current database is reviewed to understand data presentation?
Answer:
Reports and queries are reviewed to evaluate whether the information presented meets the
users' needs.
Question 5:
What is the significance of identifying redundancies in the current database?
Answer:
Identifying redundancies helps in eliminating duplicate data, ensuring data integrity, and
improving database performance.
o Use subjects from the mission objectives to identify entities that require
tracking.
o Refine the list of subjects by examining the mission objectives and removing
redundancies.
o Identify implied subjects that may not be explicitly mentioned but are
necessary.
o Avoid vague terms and ensure the names are consistent and intuitive.
o Break down fields containing multiple pieces of data into smaller atomic
fields.
Example: Split a "Full Name" field into "First Name" and "Last Name."
o If a field holds multiple values (e.g., multiple phone numbers), create a new
table to manage the relationship between the entity and its values.
8. Establishing Subset Tables:
o Ensure no fields are duplicated across tables unless they are foreign keys.
Question 1:
What is the purpose of defining the preliminary table list?
Answer:
The purpose is to identify all subjects (entities) that need to be tracked in the database,
ensuring they align with the mission objectives.
Question 2:
Why is it important to resolve multi-part fields during table design?
Answer:
Multi-part fields must be resolved to maintain atomicity, ensuring each field holds only one
piece of data.
Question 3:
What is the recommended action when a field contains multiple values?
Answer:
Create a separate table to store the multivalued data and establish a relationship with the
main table.
Question 4:
What should you consider when assigning names to tables?
Answer:
Table names should be clear, descriptive, consistent, and intuitive, avoiding vague or overly
generic terms.
Question 5:
What are subset tables, and when should they be created?
Answer:
Subset tables are created when certain fields apply only to a specific subset of records in a
main table, helping to organize and structure the data more effectively.
Question 6:
Why is it important to avoid redundancy in table structures?
Answer:
Avoiding redundancy ensures data consistency, eliminates unnecessary duplication, and
improves database performance.
Purpose:
This chapter focuses on the importance of keys in relational database design. Keys play a
crucial role in maintaining data integrity, defining relationships between tables, and ensuring
data uniqueness.
o Definition: Keys are fields or sets of fields used to identify records in a table
uniquely.
o Importance: They ensure data consistency and are essential for establishing
relationships between tables.
2. Types of Keys:
o Primary Keys: A chosen candidate key that uniquely identifies each record in
a table. Only one primary key is allowed per table.
o Alternate Keys: Candidate keys not selected as the primary key but still
capable of uniquely identifying records.
o Foreign Keys: Fields in one table that refer to the primary key in another
table, establishing a relationship between the tables.
o Select the simplest candidate key that uniquely identifies each record.
o Avoid fields that are likely to change, such as names or phone numbers.
o Enforce referential integrity, ensuring that foreign key values match primary
key values in the referenced table.
7. Table-Level Integrity:
o Primary keys ensure no duplicate rows, and foreign keys validate the
existence of related data.
o Ensure that all tables have a primary key and that foreign keys accurately
define relationships.
Question 2:
What is the difference between a candidate key and a primary key?
Answer:
A candidate key is any field or combination of fields that can uniquely identify a record,
while a primary key is the selected candidate key used for this purpose.
Question 3:
Why are surrogate keys often used in database design?
Answer:
Surrogate keys are used when no natural key exists or when natural keys are complex, prone
to change, or not intuitive.
Question 4:
What is a composite key, and when would you use one?
Answer:
A composite key is a primary key consisting of two or more fields. It is used when a single
field cannot uniquely identify a record, such as in many-to-many relationships.
Question 5:
How does a foreign key ensure referential integrity?
Answer:
A foreign key ensures referential integrity by requiring that the values in the foreign key
field(s) match values in the referenced table's primary key field(s).
Question 6:
What are the characteristics of a good primary key?
Answer:
A good primary key is unique, stable, minimal, and, if possible, simple and intuitive.
Question 7:
Why is it important to review and refine keys during database design?
Answer:
Reviewing and refining keys ensures they are efficient, maintainable, and correctly enforce
data integrity and relationships.
General Elements:
Physical Elements:
o Data Type: Specifies the kind of data (e.g., integer, text, date).
o Null Support: Determines whether the field can contain NULL values.
Logical Elements:
Ensure specifications align with business rules and the database's mission objectives.
4. Field-Level Integrity:
Use validation rules and domain restrictions to prevent invalid data entry.
Unique Fields: Fields that serve as unique identifiers, like primary keys.
Generic Fields: Fields that appear across multiple tables but don’t hold unique values
(e.g., Address).
Replica Fields: Fields duplicated across tables for relational purposes, typically as
foreign keys.
Question 1:
What is the purpose of creating field specifications?
Answer:
Field specifications ensure consistency, accuracy, and clarity in how data is stored, validated,
and documented.
Question 2:
What are the three main elements of a field specification?
Answer:
The three main elements are:
Question 3:
Why is it important to define the data type for a field?
Answer:
Defining the data type ensures data is stored in the correct format, improves performance,
and helps enforce data integrity.
Question 4:
What is the difference between a domain of values and a range of values?
Answer:
A range of values defines minimum and maximum numeric or date limits (e.g., 0 to
100).
Question 5:
What are replica fields, and why are they used?
Answer:
Replica fields are duplicates of fields (usually foreign keys) in related tables, used to establish
relationships and maintain referential integrity.
Question 6:
How does a Field Specifications Form help in database design?
Answer:
It provides a systematic way to document the attributes and rules for each field, ensuring
clarity and consistency in implementation.
Question 7:
What is field-level integrity, and how is it enforced?
Answer:
Field-level integrity ensures valid data entry through constraints like data types, default
values, null support, and validation rules.
Purpose:
This chapter focuses on the concept of relationships between tables in a relational database.
Relationships are crucial for connecting data, ensuring integrity, and allowing efficient
querying.
Key Concepts in Chapter 10:
2. Types of Relationships:
3. Establishing Relationships:
Primary Key–Foreign Key Pair: A primary key in one table is referenced as a foreign
key in another to establish the link.
4. Self-Referencing Relationships:
o Example: An employee table where each employee has a manager who is also
an employee.
Participation Type:
o Mandatory Participation: All records in one table must be related to records
in the other table.
o Optional Participation: Records in one table can exist without related records
in the other.
Degree of Participation: Defines the number of related records allowed (e.g., one or
many).
6. Deletion Rules:
Define how deletions in a primary table affect related records in a foreign table.
o Set Default: Assign a default value to the foreign key in related records.
8. Relationship-Level Integrity:
Question 1:
What are the three main types of relationships in a relational database?
Answer:
One-to-One (1:1)
One-to-Many (1:N)
Many-to-Many (M:N)
Question 2:
How is a many-to-many (M:N) relationship implemented in a relational database?
Answer:
An M:N relationship is implemented using a junction table that includes foreign keys
referencing the primary keys of the related tables.
Question 3:
What is the purpose of a foreign key in a table?
Answer:
A foreign key establishes a relationship between tables by referencing the primary key in
another table, ensuring referential integrity.
Question 4:
What is a self-referencing relationship? Provide an example.
Answer:
A self-referencing relationship is when a table relates to itself.
Example: An employee table where each employee has a manager who is also an employee.
Question 5:
What are the common deletion rules for relationships, and what do they mean?
Answer:
Set Default: Assign default values to foreign key fields in related records.
Question 6:
What is the difference between mandatory and optional participation in relationships?
Answer:
Mandatory Participation: Every record in one table must have a related record in the
other table.
Optional Participation: Records in one table may exist without a related record in the
other table.
Question 7:
Why is it important to verify relationships with users?
Answer:
Verifying relationships ensures they accurately represent real-world associations and meet
business requirements.
Question 8:
What is the purpose of referential integrity in table relationships?
Answer:
Referential integrity ensures consistency and validity by enforcing that foreign key values
match primary key values in the referenced table.
Purpose:
This chapter emphasizes the role of business rules in database design. Business rules define
the constraints, conditions, and operations that govern how data is managed, ensuring the
database aligns with organizational goals and policies.
Definition: Business rules are statements that define or constrain aspects of the
database, ensuring it supports the organization’s processes and policies.
Purpose: They provide a framework for maintaining data integrity and consistency.
o Example: A field for age must only accept values between 0 and 120.
Data-Specific Rules: Enforce the proper structure, content, and behavior of data
across multiple fields or tables.
o Example: The start date of a project must be earlier than the end date.
Static Rules: Apply fixed constraints (e.g., a product price must be positive).
Dynamic Rules: Change based on external factors or events (e.g., a discount applies
only during a specific period).
Working with Users and Management: Collaborate to gather rules directly from
stakeholders who use or oversee the system.
5. Validation Tables:
o Example: A table listing valid payment methods (Credit Card, PayPal, etc.).
Business Rule Specifications Sheet: A structured document that outlines the rules
for each table, field, and relationship.
Importance: Serves as a reference for developers and ensures that rules are applied
consistently across the database.
Question 1:
What are business rules in the context of database design?
Answer:
Business rules are constraints or conditions that define how data is managed, ensuring the
database supports the organization’s processes and policies.
Question 2:
What are the two main types of business rules?
Answer:
Question 3:
What is the purpose of a validation table?
Answer:
A validation table restricts data to a predefined set of acceptable values, ensuring
consistency and simplifying updates to the list of valid entries.
Question 4:
How are static and dynamic rules different?
Answer:
Static Rules: Apply fixed constraints that do not change (e.g., age must be a positive
number).
Question 5:
Why is it important to document business rules?
Answer:
Documenting business rules ensures clarity, consistency, and serves as a reference for
developers to implement and maintain the database correctly.
Question 6:
Give an example of a field-specific rule and a relationship-specific rule.
Answer:
Field-Specific Rule: A phone number must follow the format (XXX) XXX-XXXX.
Question 7:
What is a business rule specifications sheet?
Answer:
A structured document outlining all the rules for fields, tables, and relationships in the
database, ensuring consistent application and serving as a reference.
Question 8:
Why is it necessary to review business rules with users?
Answer:
Reviewing business rules ensures they align with real-world scenarios, meet user needs, and
accurately reflect organizational processes.
Key Concepts:
o A view is a virtual table derived from one or more actual tables in the
database.
2. Anatomy of a View:
o Data Views: Basic views that present data directly from tables.
Key Concepts:
4. Final Review:
o A thorough review ensures all integrity rules are implemented correctly
before deploying the database.
o Answer: A virtual table derived from one or more actual tables, used to
simplify queries and enhance data security.