Domain Relational Calculus: A Form Of Relational Calculus

799 Words2 Pages

DOMAIN RELATIONAL CALCULUS • A form of Relational Calculus which uses domain variables that take on values from an attributes domain, rather than values for an entire tuple. • Closely related to the tuple relational calculus. • Serves as the theoretical basis of the widely used QBE(Query-By-Example) language. FORMAL DEFINITION An expression in the domain relational calculus is of the form {< x1, x2, … , xn > | P(x1, x2, … , xn) } where x1, x2, … , xn represents domain variables. P represents a formula composed of atoms. An Atom in the domain relational calculus has one of the following forms: • < x1, x2, … , xn > ∈ r , where r is a relation on n attributes and x1, x2, … , xn are domain variables or domain constraints. • xΘy , where x …show more content…

We build up formulae from atoms by using the following rules: • An Atom is a formula. • If P1 is a formula, then so are ¬P1 and (P1). • If P1 and P2 are formulae, then so are P1 ⋁ P2, P1 ⋀ P2, and P1 ⇒ P2. • If P1(x) is a formula in x, where x is a free domain variable, then ∃ x (P1(x)) and ∀ x (P1(x)) An expression of the domain calculus is of the following form: {Xl, X2, ... , Xn I COND(XI, X2, .. •, Xn, Xn+b Xn+2, , …show more content…

, Xn, Xn+b Xn+2, , Xn+m are domain variables that range over domains of attributes and COND is a condition or formula of the domain relational calculus. Expression of the domain calculus are constructed from the following elements: • Domain variables Xl, X2, ... , Xn, Xn+b Xn+2, ... , Xn+m each domain variable is to range over some specified domain . • Conditions, which can take two forms: • Simple comparisons of the form x * y, as for the tuple calculus, except that x and yare now domain variables. • Membership conditions, of the form R (term, term ...). Here, R is a relation, and each "term" is a pair AV, where A in turn is an attribute of R and V is either a domain variable or a constant. For example EMP (empno: 100, ename: 'Ajay') is a membership condition (which evaluates to true if and only if there exists an EMP tuple having empno=100 and ename = 'Ajay') . • Well Formed Formulaes (WFFs), formed in accordance with rules of tuple calculus (but with the revised definition of "condition"). Free and Bound Variables The rules concerning free and bound variables given for the tuple calculus are also applicable similarly on the domain calculus. Examples Consider again the following

Open Document