2.3 Given the relations R (A, B) and S (B, C) where values are all integers. Examine the undermentioned three relational algebra expressions: a. A, C(R⋈B=1S) b. A(B = 1R)XC(B = 1S) c. A, C (ARXB = 1S) Two of the three expressions are equivalent (i.e., they produce the same answer on all databases), while one of them can produce a different answer.
2.3.1 Which query can produce a contrasting answer? Give the simplest database instance you can think of where a different answer is produced. (5)
2.3.2 Why do we care that the expressions are equivalent? (5)
2.3.3 How can we determine that the expressions are equivalent?
2.3.1
Query C can produce a constrasting answer.
Suppose S={(1,2)} and R is {(3,4)}. Query A will produce an empty result.
Query B will also produce an empty result similar to the result of A.
Query C will produce {(3,2)}
2.3.2
It is important for expressions are equivalent so that there can be no
redundancy in case of insert operation. Additionally, to maintain the consistency
of the database.
2.3.3
Iy is possible to determine if expressios are equivalent by checking if they are producing
the same answer on all databases.
Comments
Leave a comment