2 Feb 2020

  • February 02, 2020
  • Amitraj
Virtual Records

-> In the case of many-to-many relationships, record replication is necessary to preserve the tree-structure organization of the database.
Record replication has two major drawbacks:-

a. Data inconsistency may result when updating takes place
b. Waste of space is unavoidable


figure 1 : Tree Structure Diagram with virtual Records






Several ways to Eliminate these drawbacks -

-> To eliminate record replication, we need to relax our requirement that the logical organization of data be constrained to a tree structure. We need to do that cautiously, however, since otherwise we will end up with the network model.


-> The solution is to introduce the concept of a virtual record. Such a record contains no data value; it does contain a logical pointer to a particular physical record. Instead of replication, we keep a single copy of the physical record, and everywhere else we keep virtual records containing a pointer to that physical record.

->  Let R be a record type that is replicated in T1, T2, . . ., Tn. Create a new virtual record type virtual-R and replace R in each of the n – 1 trees with a record of type virtual-R.


-> Replace account with virtual-account in the first tree, and replace customer with virtual-customer in the second tree.

-> Add a dashed line from virtual-customer to customer, and from
virtual-account to account, to specify the association between a
virtual record and its corresponding physical record.






Sample Database Diagram -


figure 2 : Sample database Corresponding to diagram of figure 1

















Translate

Popular Posts