Database Design - Summerize ch1-5
Database Design - Summerize ch1-5
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.