A data model is the result of developing the logical design for a proposed system and ends up being the definition around which all applications in the system must work. Once completed, each element of the model might end up being a table definition, an XML schema, or some other form of defined implementation. Before we get to the implementation, there is a lot of work to accomplish, and attention to detail will save time and effort later. A common basis for data modeling is the Entity Relationship Model (ER Model). Although there are other modeling techniques, ER modeling has become the favorite of most data experts. Entity Relationship ModelingThe ER Model allows a database to be set up in a fairly simple and organized manner. The simplicity of a data model gives it the advantage of flexibility; this benefit enables you to easily create and enhance databases based on business requirements as needed. Many other model formats are also commonly used, each having similar characteristics for mapping out a potential structure. Figure 8.1 represents a partially completed ER model. Note that this ER diagram is not intended to contain the complete set of tables for a solution, nor are any of the tables necessarily complete. Errors included in this figure are discussed and corrected later. We will refer to this model as we work through this chapter's concepts. Figure 8.1. A partial ER diagram for Billington Pharmaceuticals.Entity structuring accommodates the initial stages of data design. When you're designing an appropriate logical model, the data must be organized into separate elements called entities that will later make up the physical tables within a database. Entities can be categorized as kernel, associative, or characteristic and are characterized by their attributes, which define the data elements (fields and columns) of an entity. The key attribute is referred to as an entity's identifier, much as a person's name identifies that person as being an individual different from all others. Entities are usually interdependent: Each holds information that relates to other entities. These relationships can be defined by their correlated dependencies. The development of actual physical elements will undergo various changes from the point that a rough plan is put on paper. Often, at the outset of design, the entity structure is represented by rough drawings that organize the data elements. After a developer has all the data elements, the division of elements into a logical entity structure can begin. Entities, attributes, identifiers, and dependencies are characterized as follows:
Modeling data into entities is simple, and a number of data modeling tools are available to assist in this design. Microsoft has the Visio product, which is an excellent design tool for a variety of purposes, including databases, programming, flowcharting, network design, and more. There are also many third-party products that can give you the tools needed to document a logical design. One of the most popular tools in a lot of business environments is ERWIN, now owned by Computer Associates. Business RulesA business rule is the implementation of a portion of company policies and procedures that help enforce data integrity or data correctness. A business rule is defined in the logical design as a limitation placed on the data. These rules can be implemented as a property of the data or as a product of another tier in the overall logical design of a project. The database server can enforce an attribute so that it cannot exceed an upper limit or one that must have a value equal to one of a selection of choices. Also, data type requirements can be more strictly enforced for additional control over attributes that contain alphanumeric information but require a specific format or picture. When you implement business rules, you can immediately take action to correct the data before it is permanently saved to the database. For example, a company can have a guideline that customers not be allowed to owe more than $1,000 or that free delivery of a product is limited to one of three states. These types of rules can be placed at the entity or attribute level; however, it is important to note that the implementation of many of these rules can be performed in the user interface or as a separate business rules tier between the user interface and the data storage. By defining business rules that apply to your data during the logical design phase of development, you allow for a smoother implementation. Also, as the logical design becomes further defined, other rules that were missed in the initial process will be easier to spot. Now that you understand some concepts of designing the data model, take a closer look at the definitions provided in the following sections. You will note a definite crossover between the logical and physical design. Although these design stages are usually separate, they have been combined to more easily fit the structure of this book and better prepare you for the exam. |