Databases Reference
In-Depth Information
Deductive DBs allow the definition of derived predicates, but SQL2
also allows the definition of views. For instance, predicate GrandMother in
Example 4.1 could be defined in SQL2 as
CREATE VIEW grandmother AS
SELECT mother.x, parent.y
FROM mother, parent
WHERE mother.z=parent.z
Negative literals appearing in deductive rules can be defined by means
of the NOT EXISTS operator from SQL2. Moreover, views defined by more
than one rule can be expressed by the UNION operator from SQL2.
SQL2 also allows the definition of integrity constraints, either at the
level of table definition or as assertions representing conditions to be satisfied
by the DB. For instance, the second integrity constraint in Example 4.1
could be defined as
CREATE ASSERTION ic2 CHECK
(NOT EXISTS (
SELECT father.x
FROM father, mother
WHERE father.x=mother.x ))
On the other hand, key and referential integrity constraints and exclu-
sion dependencies, which are defined at the level of table definition in SQL2,
can also be defined as inconsistency predicates in deductive DBs.
Although SQL2 can define views and constraints, it does not provide a
mechanism to define recursive views. Thus, for instance, the derived predi-
cate Ancestor could not be defined in SQL2. In contrast, Datalog is able to
define recursive views, as we saw in Example 4.1. In fact, that is the main
difference between the expressive power of Datalog and that of SQL2, a limi-
tation to be overcome by SQL3, which will also allow the definition of recur-
sive views by means of a Datalog-like language.
Commercial relational DBs do not yet provide the full expressive
power of SQL2. That limitation probably will be overcome in the next few
years; perhaps then commercial products will tend to provide SQL3. If that
is achieved, there will be no significant difference between the expressive
power of Datalog and that of commercial relational DBs.
Despite these minor differences, all problems studied so far in the con-
text of deductive DBs have to be solved by commercial relational DBMSs
Search WWH ::




Custom Search