Session – 19 INTEGRATY AND SECURITY INTEGRITY Matakuliah: M0184 / Pengolahan Data Distribusi Tahun: 2005 Versi:
OBJECTIVE Integrity constraint Integrity in centralized database Integrity in distributed database
Integrity Integrity of a DB is concerned with consistency, correctness, validity and accuracy that stated by the rules of organizational model These rules called integrity constraints
Integrity in Centralized Database Basic integrity constraint Relation Domain Referential Explicit
Relation Constraint The method used to define relations. Example : CREATE TABLE PATIENT (patient# integer NOT NULL, name varchar (20) NOT NULL, DOB date, address varchar(50), sex varchar(1) ) Primary key patient# Primary key must always define with NOT NULL to guarantee the uniqueness property and no two patient will have the same patient#
DOMAIN Constraint Example : CREATE DOMAIN patient#integer patient# > 0 and patient# < 10000, It can be specified : patient# is integer in range 1 to 9999
Referential Integrity Example : PATIENT (patient#, name, DOB, address, sex) LABREQ (patient#, test-type, date, docter-req) Laboratory request can be request by patient only Patient# in LABREQ as a foreign key must have match in PATIENT table.
Integrity in distributed database Problem issue around integrity in DDB Inconsistencies between local integrity constraint Difficulties in specifying global integrity constraint Inconsistencies between local and global constraint
Local Integrity Constraint Specified and enforced by the local DBMS and nodal autonomy Different rules could apply at different nodes. So it will make confusion for global user
Global Integrity Constraint Global constraint is necessary to maintain integrity of a large organizational with several semi-autonomous department, each running its own DBMS and managing its own DB employee Global integrity constraint can be stored in the global schema catalogue and apply at the global level to global transactions
Inconsistencies between local and global constraint If both local and global constraint are permit, there must be a way of resolving inconsistencies between them If there’s a strong global control, then it’s likely global constraint will have priority If the DB just participating in a loose federation with no global control, then local integrity will dominate