Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 21 trang
THÔNG TIN TÀI LIỆU
Nội dung
Session 1Introduction to Data Integrity
Session ObjectivesIn this session we will learn about:–Data IntegrityDefine and describe data integrityList the rules for data integrity–Types of Data Integrity–Integrity Constraint
Data integrityIn a database when data is entered or modified, the entered value need to be valid and accurate. Also, if any modification or deletion is carried out on the data, the change should reflect in all the relevant places in the database. This ensures the validity and consistency of data at all times, hence maintaining data integrityIntegrity of data can be maintained by specifying certain checks at the time of creating and modifying tables and then applying those checks when handing data
Data integrityINSERTUDATEDELETEIs the data lyingWithin the constraints?INSERT, UPDATE or DELETEoperation is invalid.Discard the changeINSERT, UPDATE or DELETEoperation is valid.Save the changeNoYes
Rules for Data IntegrityNo two records in a table can have the exact same values in all the columnsOnly valid data values can be insertedThe validity of data has to be maintained when data is modifiedWhen multiple tables are related through a common column, any changes to the data values in that column in one table should be appropriately reflected in the related tables
Business rules Business rules are the policies and standard adhered to by an organization in running its operations.These rules ensure that the data entered in the database conforms to company standards.For example, a bank can specify the maximum amount of loan and the maximum duration for loan repayment based on a person’s education level, current annual income and age
Enforcing Data IntegrityCan be enforced by subjecting the data to various checks and constraints at the time of inserting, updating and deleting data.These are:–Constraints–Default Values–Rules–Triggers
Types of Data IntegrityData integrityEntity Integrity(toàn vẹn thực thể)Domain integrity(toàn vẹn miền)ReferentialIntegrity(toàn vẹn tham chiếu)User-definedIntegrity(toàn vẹn do ng dùng định nghĩa)
Entity IntegrityA table in a database represents an entity where as each record within the table represents an instance of that entityEntity integrity is ensued using:–PRIMARY KEY constraint–UNIQUE constraint–Indexes–IDENTITY property
Domain integrityA domain defines a logical set of values that make up the valid values in a columnDomain integrity is maintained using:–FOREIGN KEY constraint–CHECK constraints–DEFAULT definitions–NOT NULL definitions–Data types–Rules
123doc.vn