Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 24 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
24
Dung lượng
334,81 KB
Nội dung
Module7:ImplementingDataIntegrityModule 1: Course Overview Module 4: Deriving a Logical Data Design Module 5: Normalizing the Logical Data Design Module 6: Deriving a Physical Data Design Module7:ImplementingDataIntegrityModule 2: Solution Design Processes Module 3: Using a Conceptual Design for Data Requirements Module 8: Designing Data Services Module 9: Data Storage Considerations Designing Data Services and Data Models Overview of DataIntegrityImplementing Business Rules and DataIntegrity Activity 7.1: Identifying DataIntegrity Requirements Activity 7.2: Determining Business and DataIntegrity Implementations Module7:ImplementingDataIntegrityModule7:ImplementingDataIntegrity 147 ! !! ! Overview " Overview of DataIntegrity " ImplementingDataIntegrity Requirements " Review In this module . In this module . At the end of this module, you will be able to: " Identify business rules that relate to data integrity. " Identify the dataintegrity requirement type to which a business rule applies. " Evaluate and determine a location for implementingdata integrity. " List implementation techniques for a given dataintegrity requirement. Slide Objective To provide an overview of this module’s topics and objectives. Lead-in In this module, you will learn how to enforce business rules and maintain data integrity. 148 Module7:ImplementingDataIntegrity ! !! ! Overview of DataIntegrity " DataIntegrity Categories " Referential Integrity " Data Validation " Identifying DataIntegrity Requirements " Activity 7.1: Identifying DataIntegrity Requirements In this section . In this section . In this section, you will learn about different types of dataintegrity requirements. Slide Objective To provide an overview of data integrity. Lead-in This section discusses dataintegrity rules and ways of enforcing them. Module7:ImplementingDataIntegrity 149 DataIntegrity Categories Domain Integrity ( columns ) Entity Integrity ( rows ) " Domain integrity determines the allowable values for an attribute " Entity integrity ensures that an instance of an entity is unique Referential IntegrityDataintegrity refers to the consistency and accuracy of data. An important step in database planning is deciding how to ensure this integrity. Three categories of dataintegrity can be employed: domain, entity, and referential. Here you will learn about domain and entity integrity. (Referential integrity will be discussed in detail in the following topic.) Domain integrity Domain (or column) integrity specifies a set of legitimate data values for a column and determines whether null values are to be allowed. Implementing validity checking can often enforce domain integrity. Restricting the data type, format, or range of possible values allowed in a column can also enforce domain integrity. Entity integrity Entity (or row) integrity requires that all rows in a table have a unique identifier, known as the primary key value. Whether the primary key value can be changed, or whether an entire row can be deleted, depends on the level of referential integrity required between the primary key of the table and the foreign keys of any other tables. When used together, domain and entity integrity help to ensure that each entity in a physical design maintains consistency. When planning for databases in your design, you must consider consistency among entities and data validity within the entities as important additional aspects of data integrity. Slide Objective To introduce the concept of data integrity. Lead-in Dataintegrity refers to the consistency and accuracy of data and falls into three categories: domain, entity, and referential. 150 Module7:ImplementingDataIntegrity Referential Integrity " Ensures that each child entity has a related parent entity " Is built on domain and entity integrity principles The domain and entity integrity categories suffice for enforcing dataintegrity in a single table; however, many databases contain multiple tables with parent and child entities that are related. When both the entities in a relationship must exist and must have a valid link to one another, referential integrity makes sure that these conditions are met. Referential integrity ensures that the relationships between the primary keys (in the parent entity’s table) and foreign keys (in the child entity’s table) are always maintained. As a result of the restrictions that referential integrity imposes on tables, it is important for you to consider what to do when a primary key must be updated or deleted. If the primary key’s value in the parent entity is changed or deleted, then the instance of that entity has been modified, thus necessitating corresponding modifications in all child entities that reference the parent. By cascading, or walking, through all related child tables and updating or deleting data as necessary, the database can maintain referential integrity. Slide Objective To explain the concept of referential integrity. Lead-in Whereas domain and entity integrity help ensure accuracy of data within a table, referential integrity helps ensure accuracy of data between tables. Module7:ImplementingDataIntegrity 151 Data Validation " Ensures that proper values are supplied $ Range checking $ Data format $ Data type checking " Is implemented by two means of checking $ Client-side $ Server-side It is important to have valid data. Domain, entity, and referential integrity ensure that data exists where necessary and that entities follow a basic set of rules for existence. None of these dataintegrity categories, however, can determine whether the data is valid. You can ensure that the data is correct by checking it in the following ways: " Range checking involves making sure the data’s value falls within a set of limits determined by the functional specification. " Data format checking involves making sure the data conforms to a set of format specifications, such as currency formatting, telephone number formatting, or length-of-character strings. " Data type checking involves making sure the data belongs to the proper data type and that an invalid data type is not used to represent the data when it is written to the database. To ensure that queries return the correct information, you must make sure that the information being stored is valid. You can validate data in two ways: " Client-side checks can ensure that invalid data is not posted to a database. These checks can be coded as a script, as part of an executable program, or as part of a Web page. For example, if a field denotes a monetary value, a script can make sure that the information in that field is the proper data type and format. " Server-side checks, which are executed by the DBMS engine, can be implemented with field data types, default values, and constraints. These checks can also ensure that invalid data is not stored in the database. Slide Objective To introduce the concept of data validation. Lead-in Validity of data is of the utmost importance. This topic discusses ways to help achieve data validity. 152 Module7:ImplementingDataIntegrity The methods or combination of methods that you use depends on the objectives and requirements of your solution; each method or combination has its value. Although more difficult to maintain than server-side checks, client-side checks can help decrease the processing load on the DBMS server. Although easier to maintain, server-side checks might present a bottleneck if the server has to validate many client requests. Module7:ImplementingDataIntegrity 153 Identifying DataIntegrity Requirements " Use data requirements as a guide " Look for explicit or implicit constraints or limits " Determine where uniqueness within the requirements must exist (produces domain and entity integrity) " Determine where relationships within the requirements must exist (produces referential integrity) Identifying dataintegrity requirements helps ensure that all logical and physical requirements for a solution are met and that the physical design supports the full intent of your specification. When attempting to identify the dataintegrity requirements of a solution, you must start with the data requirements specified during the solution’s design. When examining the data requirements, you should identify areas within the requirements in which uniqueness, or limits and constraints, have been specified or deemed necessary to help ensure that entities can exist and be implemented correctly. If limits and constraints or limits have been specified or deemed necessary, you must determine whether the limits and constraints are bound to an entity or to a relationship between entities. For example, suppose you need to determine whether a particular task can exist without a related job number. If it can’t, you must implement a dataintegrity requirement to make sure that no instance of that task is created without a corresponding job number. Alternatively, suppose a consultant must submit a weekly timesheet for a client. No timesheet can duplicate another timesheet, and no two timesheets can represent the same time or work performed by a consultant. Therefore, a dataintegrity requirement exists for guaranteeing the uniqueness of timesheet information. Each timesheet within the database must be represented by a unique attribute or a combination of unique attributes. Finally, you must implement referential integrity requirements to ensure that all relationships are maintained. For example, if a customer wants to be removed from Ferguson and Bardell, Inc.’s database, a referential integrity requirement must ensure that the customer cannot be deleted as long as payment has not been received for any outstanding invoices. Slide Objective To introduce the method for identifying integrity requirements within a physical design. Lead-in Identifying integrity requirements helps validate your physical design and also ensures valid data. 154 Module7:ImplementingDataIntegrity Activity 7.1: Identifying DataIntegrity Requirements In this activity, you will evaluate a set of data requirements from the Ferguson and Bardell, Inc. case study to determine areas where possible dataintegrity issues might arise. You will then formulate a set of dataintegrity requirements that must be followed by the development team for the Ferguson and Bardell, Inc. solution. After completing this activity, you will be able to: " Identify areas where dataintegrity and validity are required. " Specify dataintegrity requirements as they relate to data requirements. Slide Objective To introduce this activity. Lead-in In this activity, you will determine dataintegrity requirements for a solution. [...]... here Module 9: Data Storage Considerations Lead-in The next module discusses data access methods Module 1: Course Overview Module 8: Designing Data Services Module7:ImplementingDataIntegrityModule 2: Solution Design Processes Designing Data Services and Data Models Module 3: Using a Conceptual Design for Data Requirements Module 4: Deriving a Logical Data Design Module 6: Deriving a Physical Data. .. languages 158 Module7:ImplementingDataIntegrityImplementing in the Database Slide Objective To introduce declarative ways of implementing data integrity " " One way to implement dataintegrity is to implement it directly in the database Criteria defined in table definitions " Lead-in Dataintegrity enforced automatically Built-in database features $ Data types $ Default values $ Data validation.. .Module 7: Implementing Data Integrity 155 ! Implementing Data Integrity Requirements Slide Objective To provide an overview of the methods used to implement dataintegrity requirements Lead-in This section discusses ways in which dataintegrity can be implemented " Identifying Business Rules " Deploying Business Rules and DataIntegrity Requirements " Implementing in the Database " Implementing. .. can maintain data integrity? Data types, data formats, constraints, and custom scripts 4 What are two ways in which data consistency is usually maintained? Which method provides for consistency between entities? Data validation and referential integrity Referential integrity 5 What are the three categories of data integrity? Domain, entity, and referential Module7: Implementing Data Integrity Looking... trigger can verify data in other tables or perform an automatic update to a different table 160 Module7: Implementing Data Integrity Implementing Programmatically Slide Objective To introduce methods for implementingdataintegrity programmatically " Dataintegrity enforced through logic $ If a dataintegrity requirement is complex, you can implement it programmatically " Encapsulated in an executable... within the physical design where dataintegrity requirements and business rules should be implemented with the methods presented in this module After completing this activity, you will be able to: " Identify areas where dataintegrity should be enforced " Choose a method for implementing business rules and dataintegrity requirements 163 164 Module7:ImplementingDataIntegrity ! Review Slide Objective... a Logical Data Design Module 6: Deriving a Physical Data Design Module 5: Normalizing the Logical Data Design In the next module, you will learn about data access methods You will also examine the following: " Accessing data " Data access technologies " Determining a location for data access objects 167 168 Module7:ImplementingDataIntegrity THIS PAGE INTENTIONALLY LEFT BLANK ... Use data types appropriately Be sure to use a Date data type for a date or time field, instead of using a string formatted to display as a date Accurate data types help ensure integrity by relating each field to the values it represents They also ease processing loads during data manipulation and formatting 166 Module7:ImplementingDataIntegrity Review Questions Slide Objective To reinforce this module s... Lead-in These review questions cover some of the key concepts taught in this module " Identify business rules that relate to dataintegrity " Identify the dataintegrity requirement type to which a business rule applies " Evaluate and determine a location for implementingdataintegrity " List implementation techniques for a given dataintegrity requirement 1 Give an example of a business rule Answers may... contract is received Module 7:ImplementingDataIntegrity 157 Deploying Business Rules and DataIntegrity Requirements Slide Objective To introduce the different ways in which business rules can be deployed " Two deployment strategies $ Lead-in Business rules can be deployed in two ways: in the database or programmatically within or outside of the database $ " Directly in the database Programmatically . Implementations Module 7: Implementing Data Integrity Module 7: Implementing Data Integrity 147 ! !! ! Overview " Overview of Data Integrity " Implementing. of data integrity. Lead-in This section discusses data integrity rules and ways of enforcing them. Module 7: Implementing Data Integrity 149 Data Integrity