U de C - logo

SPATIAL DATABASES

diicc - logo

Consistency Issues> Consistency in Traditional Databases

 

Consistency refers to the presence of non conflicting facts in a database with respect to a model of reality. Inconsistency arises when integrity constraints are violated. Thus, integrity constraints must be taken into account when updating a database so that the semantics and quality of data are preserved.

In general, an integrity constraint can be an arbitraty predicate pertaining to the database;however, they may be costly to test.

Some of the most common integrity constraints for a relatinal database are:

Domain constraints: It checks that attribute values must be within a domain. For example, using SQL-92, one could specify the following constraints:

create domain account-number chat(10)
constraint account-number-null-test check(value not null)

create domain account-number chat(10)
constraint account-type-test check(value in ("Checking","Saving"))

Referential Integrity: It checks that a value that appears in one relation must appear for a certain set of attributes in another relation. Consider the primary and candidate keys, and the foreign keys as part of the SQL table statement:

create table costumer
( customer-name char(20) not null,
customer-street char(30),
customer-city char(30),
primary key (customer-name))

create table account
(account-number char(20) not null,
balance integer,
primary key (account number),
check(balance >=0))

create table depositor
( customer-name char(20) not null;
account-number char(10) not null,
primary key (customer-name,account-number),
foreign key (customer-name) references customer,
foreign key (account-number) references account)

In relational databases assertions are predicates expressing conditions that we wish the database always satisfy. Domain constraints and referential-integrity constraints are special formats of assertions.

create assertion <name> check <predicate>

Triggers are statements that are executed automatically by the system as a side effect of modifications to the database.

define trigger <name> on update of <relations R> <trigger-body>

Functional dependence. It establishes a dependence of attributes a -> b, such that for all pair of tuples t1 and t2 in a relation r, where attribute x and t1[a] = t2[a], then it is also the case that t1[b] = t2[b].


Valid HTML 4.0! Valid CSS!