Chapter 2



Chapter 2

Introduction to Database Development

Answers to Group I Questions

2.1 Name the major components of a database system, and briefly explain the function of each.

Database has user data; metadata (describes the structure of the database); indexes (used to improve performance); and application metadata (describes the structure of the application components).

DBMS is a general-purpose product used to design, process, and administer the database.

Application programs have application logic, and enforce business rules that cannot be enforced by the DBMS.

2.2 Give an example, other than the one in this chapter, of a relation that is likely to have problems when it is updated. Use relation R1 as an example.

PART (PartNumber, PartDescription, VendorName, VendorPhone), where a vendor provides many parts, but a part comes from just one vendor.

2.3 Transpose the relation in your answer to Question 2.2 into two or more relations that do not have update problems. Use relations R2 and R3 as examples.

PART (PartNumber, PartDescription, VendorName)

VENDOR (VendorName, VendorPhone)

2.4 Explain the roles of metadata and system tables.

Metadata describes the structure of the database. Usually, metadata is placed in tables, so that the DBMS query and reporting facilities can be used to report on the structure of the database.

2.5 What is the function of indexes? When are they desirable, and what is their cost?

Indexes improve performance for sorting and direct retrieval and can be used to enforce uniqueness in a column. They are desirable when any of the benefits described above are needed in the application. The cost is that Indexes must be updated whenever the source data involved in the index is changed.

2.6 What is the function of application metadata? How does it differ from metadata?

Application metadata is a description of the application components such as forms, reports, menus, and queries. It differs from metadata, which is a description of the database structure.

2.7 Explain the features and functions of the design tools subsystem of a DBMS.

To facilitate the design and creation of the database and its applications.

2.8 Describe the features and functions of a DBMS’s run-time subsystem.

It processes requests generated by the application. For example, it finds rows of tables based on column values and returns a set of rows to the application.

2.9 Explain the features and functions of the DBMS engine.

The DBMS engine is the intermediary between the design tools and the run-time subsystems and the operating system. For example, Access uses one of two different engines; the native engine used with mdb files is called Jet. SQL Server is the engine used with .adp files.

2.10 What is a database schema? List its components.

A schema is a description of the structure of the database's tables, relationships, domains, and business rules.

2.11 How are relationships represented in a relational database design? Give an example of two tables with a 1:N relationship, and explain how the relationship is expressed in the data.

Relationships are expressed by placing the key of one table into a second table. For example, for the PART and VENDOR tables in the answer to question 2.3 above, the key of VENDOR, which is VendorName, has been placed in PART.

2.12 What is a domain, and why is it important?

A domain is a set of values that a column may have. (Note that in Chapter 4 we will add that a domain has both a physical description and a semantic description. All Char (10) domains are not equal!

2.13 What are business rules? Give an example of possible business rules for the relations in your answer to Question 2.11.

Business rules are restrictions on the business’ activities that must be reflected in the database and database applications. Examples: 1) A VendorName cannot exist in PART if it does not already exist in VENDOR. 2) A VendorName (in VENDOR) cannot be removed from the database unless there is no PART row that has that VendorName.

2.14 What is a foreign key? Which column(s) in your answer to Question 2.11 is a foreign key?

A foreign key is a key of a table that is different from the table in which the key resides. For example, in the answer to question 2.3, VendorName (in PART) is a foreign key. VendorName (in VENDOR) is not a foreign key.

2.15 Explain the purpose of forms, reports, queries, and menus.

A form is used to enable users to create, read, modify, and delete data. A report is a structured presentation of database data. Queries allow the users to answer questions from the data. Menus are structured presentations of allowed user actions.

2.16 Explain the difference between query by example and query by form.

The primary difference is that Query by Example requires the user to see and understand the structure of the tables. Query by Form, on the other hand, hides the table structure and requires the users only to fill in form fields. Query by example is a way of expressing a query by picking columns from tables and (indirectly) causing tables to be joined. There are languages that are unique to the DBMS and languages that are standardized.

2.17 What is the first important task in developing a database and related applications?

Build a data model that identifies the things to be stored in the database and defines their structure and the relationships among them.

2.18 What is the role of a prototype?

To provide a quick means of expressing requirements for users to review.

2.19 Describe top-down development. What are its advantages and disadvantages?

Top-down works from the general to the specific. Data models are created with a global perspective; systems have better interfaces and less repeat work is required. The danger is analysis paralysis.

2.20 Describe bottom-up development. What are its advantages and disadvantages?

Bottom-up works from the specific to the general. Applications are developed much faster with less initial study and investment. The danger is that systems will be inconsistent and difficult to integrate; considerable repeat work may be required.

21. Explain the two different meanings of the term data model.

A users' data model is a description of the users' data requirements. A data model (as in the entity-relationship data model) is a vocabulary for describing a users' data model.

Answers to Group II Questions:

2.22 Implement a database with the relations CAPTAIN and ITEM in any DBMS to which you can gain access. Use one of the DBMS products facilities to enter data into each of these relations. Create and process a query to use the DBMS’s facility to process a query that identifies those items checked out before September 1, 2001, that have not yet been checked back in. Print the name of the captain, his or her phone number, and the quantity and description of any such items.

You can find this database in Access 2002 format in our instructor support site at kroenke/. Look for the database named Chapter2_Example.mdb

2.23 Interview a professional database application developer, and find out the process that this person uses to develop databases. Is this top-down development, bottom-up development, or some other strategy? How does this developer build data models and with what tools? What are the biggest problems usually encountered in developing a database?

Answers will vary.

2.24 Consider the statement “A database is a model of the users’ model of reality.” How does it differ from “A database is a model of reality?” Suppose two developers disagree about a data model, and one of them asserts, “My model is a better representation of reality.” What does this person really mean? What differences are likely to result when a developer believes the first statement more than the second statement?

This question is setting the stage for a discussion to come at the end of Chapter 3. I personally have wasted considerable time in my life arguing with other developers that "my model is a better representation of reality than your model." Unknowingly, I was simply saying, "the way I see the world is better than the way you see the world." This is sheer arrogance; what matters is how the users see their world! A database is not a model of reality; I believe Immanuel Kant was right; reality is forever unknowable by humans. All we have is our model of reality and the best we can do when building a database is to create an accurate portrayal of the users’ models. This discussion will be picked up again at the end of Chapter 4.

Answers to FiredUp Project Questions

Consider the situation of FiredUp, Inc., the company introduced at the end of Chapter 1. Each of the stoves is accompanied by a product registration form that includes the following data:

PurchaserName, StreetAddress, ApartmentNumber, City, State/Province, Zip/PostalCode, Country, EmailAddress, PhoneNumber, DateOfPurchase, and SerialNumber

Assume that FiredUp decides to create a personal database with the following tables:

CUSTOMER (Name, StreetAddress, ApartmentNumber, City, State/Province, Zip/PostalCode, Country, EmailAddress, PhoneNumber)

and

PURCHASE (DateOfPurchase, SerialNumber)

A. Construct a table of sample data that conforms to the CUSTOMER structure. Include at least four rows in your table. For Questions A through G, just list the data using a word processor.

|Name |Street |

|12/4/2001 |12345 |

|5/5/2000 |44567 |

|11/13/2001 |55878 |

|4/4/2001 |66879 |

D. Which of the columns of the PURCHASE table could be used as a primary key of PURCHASE?

From the data in this table, either DateOfPurchase or SerialNumber could be the primary key. However, unless there is something most unusual in this application, DateOfPurchase would not normally be unique. Thus, we have to look beyond the data we have to the semantics of the application to answer this question. Here, I think SerialNumber is likely to be unique for all data and would be the better choice.

E. Using the tables defined above, there is no way to relate a particular customer to his or her stove. One way to do that would be to add SerialNumber of PURCHASE to CUSTOMER. The CUSTOMER table would then appears as:

CUSTOMER (Name, StreetAddress, ApartmentNumber, City, State/Province, Zip/PostalCode, Country, EmailAddress, PhoneNumber, SerialNumber)

Copy your sample CUSTOMER data and add the SerialNumber column to it. Call this new table CUSTOMER1.

CUSTOMER1

|Name |Street |Apt |

|12/4/2001 |12345 |J@ |

|5/5/2000 |44567 |S@ |

|11/13/2001 |55878 |G@ |

|4/4/2001 |66879 |W@ |

G. You now have three possible database structures:

DB1: CUSTOMER1 with PURCHASE

DB2: CUSTOMER with PURCHASE1 and

DB3: CUSTOMER1 with PURCHASE1

Under what circumstances would you recommend the structure in DB1? Under what circumstances would you recommend the structure in DB2?

DB1 will work if a customer is related to one or more purchases and a purchase is related to at most one customer.

DB2 will work if a purchase is related to one or more customers and a customer is related to at most one purchase.

H. Under what circumstances would you recommend the structure in DB3?

None.

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download