SlideShare a Scribd company logo
1 of 58
Chapter B: Hierarchical Model
             s Basic Concepts
             s Tree-Structure Diagrams
             s Data-Retrieval Facility
             s Update Facility
             s Virtual Records
             s Mapping of Hierarchies to Files
             s The IMS Database System




Database System Concepts, 1 st Ed.               B.1   ©VNS InfoSolutions Private Limited, Varanasi, India 22100
Basic Concepts
             s A hierarchical database consists of a collection of records which are
                  connected to one another through links.
             s a record is a collection of fields, each of which contains only one data
                  value.
             s A link is an association between precisely two records.
             s The hierarchical model differs from the network model in that the
                  records are organized as collections of trees rather than as arbitrary
                  graphs.




Database System Concepts, 1 st Ed.                  B.2     ©VNS InfoSolutions Private Limited, Varanasi, India 22100
Tree-Structure Diagrams
             s The schema for a hierarchical database consists of
                    q   boxes, which correspond to record types
                    q   lines, which correspond to links
             s Record types are organized in the form of a rooted tree.
                    q   No cycles in the underlying graph.
                    q   Relationships formed in the graph must be such that only
                        one-to-many or one-to-one relationships exist between a parent
                        and a child.




Database System Concepts, 1 st Ed.                   B.3     ©VNS InfoSolutions Private Limited, Varanasi, India 22100
General Structure




             s A parent may have an arrow pointing to a child, but a child must have
                  an arrow pointing to its parent.




Database System Concepts, 1 st Ed.                   B.4   ©VNS InfoSolutions Private Limited, Varanasi, India 22100
Tree-Structure Diagrams (Cont.)
             s Database schema is represented as a collection of tree-structure
                  diagrams.
                    q   single instance of a database tree
                    q   The root of this tree is a dummy node
                    q   The children of that node are actual instances of the appropriate
                        record type
             s When transforming E-R diagrams to corresponding tree-structure
                  diagrams, we must ensure that the resulting diagrams are in the form
                  of rooted trees.




Database System Concepts, 1 st Ed.                   B.5     ©VNS InfoSolutions Private Limited, Varanasi, India 22100
Single Relationships




Database System Concepts, 1 st Ed.            B.6   ©VNS InfoSolutions Private Limited, Varanasi, India 22100
Single relationships (Cont.)
             s Example E-R diagram with two entity sets, customer and account,
                  related through a binary, one-to-many relationship depositor.
             s Corresponding tree-structure diagram has
                    q   the record type customer with three fields: customer-name,
                        customer-street, and customer-city.
                    q   the record type account with two fields: account-number and
                        balance
                    q   the link depositor, with an arrow pointing to customer




Database System Concepts, 1 st Ed.                   B.7    ©VNS InfoSolutions Private Limited, Varanasi, India 22100
Single Relationships (Cont.)
             s If the relationship depositor is one to one, then the link depositor has
                  two arrows.




             s Only one-to-many and one-to-one relationships can be directly
                  represented in the hierarchical mode.




Database System Concepts, 1 st Ed.                B.8     ©VNS InfoSolutions Private Limited, Varanasi, India 22100
Transforming Many-To-Many
                                      Relationships

             s Must consider the type of queries expected and the degree to which
               the database schema fits the given E-R diagram.

             s In all versions of this transformation, the underlying database tree (or
                  trees) will have replicated records.




Database System Concepts, 1 st Ed.                  B.9   ©VNS InfoSolutions Private Limited, Varanasi, India 22100
Many-To Many Relationships (Cont.)




Database System Concepts, 1 st Ed.   B.10   ©VNS InfoSolutions Private Limited, Varanasi, India 22100
Many-To-Many Relationships (Cont.)
             s Create two tree-structure diagrams, T1, with the root customer, and T2,
                  with the root account.

             s In T1, create depositor, a many-to-one link from account to customer.


             s In T2, create account-customer, a many-to-one link from customer to
                  account.




Database System Concepts, 1 st Ed.              B.11   ©VNS InfoSolutions Private Limited, Varanasi, India 22100
Sample Database




Database System Concepts, 1 st Ed.         B.12   ©VNS InfoSolutions Private Limited, Varanasi, India 22100
General Relationships
             s Example ternary E-R diagram and corresponding tree-structure
                  diagrams are shown on the following page.




Database System Concepts, 1 st Ed.               B.13   ©VNS InfoSolutions Private Limited, Varanasi, India 22100
Sample Ternary Databases. (a) T 1
                          (b) T 2




Database System Concepts, 1 st Ed.   B.14   ©VNS InfoSolutions Private Limited, Varanasi, India 22100
Several Relationships
             s To correctly transform an E-R diagram with several relationships, split
                  the unrooted tree structure diagrams into several diagrams, each of
                  which is a rooted tree.

             s Example E-R diagram and transformation leading to diagram that is
                  not a rooted tree:




Database System Concepts, 1 st Ed.                B.15   ©VNS InfoSolutions Private Limited, Varanasi, India 22100
Several Relationships (Cont.)




Database System Concepts, 1 st Ed.   B.16   ©VNS InfoSolutions Private Limited, Varanasi, India 22100
Several Relationships (Cont.)
             s Corresponding diagrams in the form of rooted trees.




Database System Concepts, 1 st Ed.             B.17   ©VNS InfoSolutions Private Limited, Varanasi, India 22100
Several Relationships (2nd Example)




      s Diagram (b) contains a cycle.
      s Replicate all three record types, and create two separate diagrams.




Database System Concepts, 1 st Ed.           B.18   ©VNS InfoSolutions Private Limited, Varanasi, India 22100
Several Relationships (2nd Example)
             s Each diagram is now a rooted tree.




Database System Concepts, 1 st Ed.            B.19   ©VNS InfoSolutions Private Limited, Varanasi, India 22100
Data Retrieval Facility
             s We present querying of hierarchical databases via a simplified version
                  of DL/I, the data-manipulation language of IMS.
             s Example schema: customer-account-branch
             s A branch can have several customers, each of which can have several
                  accounts.
             s An account may belong to only one customer, and a customer can
                  belong to only one branch.




Database System Concepts, 1 st Ed.                B.20   ©VNS InfoSolutions Private Limited, Varanasi, India 22100
Example Schema




Database System Concepts, 1 st Ed.         B.21   ©VNS InfoSolutions Private Limited, Varanasi, India 22100
Program Work Area
             s A buffer storage area that contains these variables
                    q   Record templates
                    q   Currency pointers
                    q   Status flag
             s A particular program work area is associated with precisely one
                  application program.
             s Example program work area:
                    q   Templates for three record types: customer, account, and branch.
                    q   Currency pointer to the most recently accessed record of branch,
                        customer, or account type.
                    q   One status variable.




Database System Concepts, 1 st Ed.                  B.22   ©VNS InfoSolutions Private Limited, Varanasi, India 22100
The get Command
             s Data items are retrieved through the get command
                    q   locates a record in the database and sets the currency pointer to
                        point to it
                    q   copies that record from the database to the appropriate program
                        work-area template
             s The get command must specify which of the database trees is to be
                  searched.
             s State of the program work area after executing get command to
                  locate the customer record belonging to Freeman
                    q   The currency pointer points now to the record of Freeman.
                    q   The information pertaining to Freeman is copied into the customer
                        record work-area template.
                    q   DB-status is set to the value 0.




Database System Concepts, 1 st Ed.                    B.23   ©VNS InfoSolutions Private Limited, Varanasi, India 22100
The get Command (Cont.)
             s To scan all records in a consistent manner, we must impose an
                  ordering on the records.
             s Preorder search starts at the root, and then searches the subtrees of
                  the root from left to right, recursively.
                    q   Starts at the root, visits the leftmost child, visits its leftmost child,
                        and so on, until a leaf (childless) node is reached.
                    q   Move back to the parent of the leaf and visit the leftmost unvisited
                        child.
                    q   Proceed in this manner until the entire three is visited.
             s Preordered listing of the records in the example database three:
                              Parkview, Fleming, A-522, A-561, Freeman, A533,
                              Seashore, Boyd, A-409, A-622




Database System Concepts, 1 st Ed.                      B.24    ©VNS InfoSolutions Private Limited, Varanasi, India 22100
Access Within A Database Tree
             s Locates the first record (in preorder), of type <record type> that
                  satisfies the <condition> of the where clause.
             s The where clause is optional <condition> is a predicate that involves
                  either an ancestor of <record type> or the <record type> itself.
             s If where is omitted, locate the first record of type
                  <record-type>
                    q   Set currency pointer to that record
                    q   Copy its contents into the appropriate work-area template.
             s If no such record exists in the tree, then the search fails, and
                  DB-status is set to an appropriate error message.




Database System Concepts, 1 st Ed.                   B.25     ©VNS InfoSolutions Private Limited, Varanasi, India 22100
Example Queries
             s Print the address of customer Fleming:
                                 get first customer
                                      where customer.customer-name = “Fleming”;
                                 print (customer.customer-address);
             s Print an account belonging to Fleming that has a balance greater than
                  $10,000.
                                 get first account
                                      where customer.customer-name = “Fleming”;
                                           and account.balance > 10000;
                                 if DB-status = 0 then print (account.account-number);




Database System Concepts, 1 st Ed.                    B.26   ©VNS InfoSolutions Private Limited, Varanasi, India 22100
Access Within a Database Tree
                                (Cont.)
                                     get next <record type>
                                         where <condition>
         s Locates the next record (in preorder) that satisfies
              <condition>.
         s If the where clause is omitted, then the next record of type
              <record type> is located.
         s The currency pointer is used by the system to determine where to
              resume the search.
         s As before, the currency pointer, the work-area template of type <record-
              type>, and DB-status are affected.




Database System Concepts, 1 st Ed.                 B.27   ©VNS InfoSolutions Private Limited, Varanasi, India 22100
Example Query
             s Print the account number of all the accounts that have a balance
                  greater than $500

                                     get first account
                                        where account.balance > 500;
                                     while DB-status = 0 do
                                        begin
                                             print (account.account-number);
                                             get next account
                                                  where account.balance > 500;
                                     end
             s When while loop returns DB-status ≠ 0, we exhausted all account
                  records with account.balance > 500.




Database System Concepts, 1 st Ed.                   B.28   ©VNS InfoSolutions Private Limited, Varanasi, India 22100
Access Within a Database Tree
                                (Cont.)
                                     get next within parent <record type>
                                        where <condition>
             s Searches only the specific subtree whose root is the most recent
                  record that was located with either get first or get next.
             s Locates the next record (in preorder) that satisfies <condition> in the
                  subtree whose root is the parent of current of <record type>.
             s If the where clause is omitted, then the next record of type <record
                  type> within the designated subtree to resume search.
             s Use currency pointer to determine where to resume search.
             s DB-status is set to a nonzero value if no such record exists in the
                  designated subtree (rather than if none exists in the entire tree).




Database System Concepts, 1 st Ed.                   B.29   ©VNS InfoSolutions Private Limited, Varanasi, India 22100
Example Query
             s Print the total balance of all accounts belonging to Boyd:
                                     sum := 0;
                                     get first customer
                                            where customer.customer-name = “Boyd”;
                                     get next within parent account;
                                     while DB-status = 0 do
                                        begin
                                            sum = sum + account.balance;
                                            get next within parent account;
                                        end
                                     print (sum);
             s We exit from the while loop and print out the value of sum only when
                  the DB-status is set to a value not equal to 0. This value exists after
                  the get next within parent operation fails.




Database System Concepts, 1 st Ed.                     B.30   ©VNS InfoSolutions Private Limited, Varanasi, India 22100
Update Facility
             s Various mechanisms are available for updating information in the
                  database.

             s Creation and deletion of records (via the insert and delete
                  operations).

             s Modification (via the replace operation) of the content of existing
                  records.




Database System Concepts, 1 st Ed.               B.31   ©VNS InfoSolutions Private Limited, Varanasi, India 22100
Creation of New Records
             s To insert <record type> into the database, first set the appropriate
                  values in the corresponding <record type> work-area template. Then
                  execute
                                            insert <record type>
                                               where <condition>
             s If the where clause is included, the system searches the database
                  three (in preorder) for a record that satisfies the <condition> in the
                  where clause.
             s Once such a record — say, X —is found, the newly created record is
                  inserted in the tree as the leftmost child of X.
             s If where is omitted, the record is inserted in the first position (in
                  preorder) in the tree where <record type> can be inserted in
                  accordance with the specified schema.




Database System Concepts, 1 st Ed.                   B.32   ©VNS InfoSolutions Private Limited, Varanasi, India 22100
Example Queries
             s Add a new customer, Jackson, to the Seashore branch:
                                     customer.customer-name := “Jackson”;
                                     customer.customer-street := “Old Road”;
                                     customer.customer-city := “Queens”;
                                     insert customer
                                         where branch.branch-name = “Seashore”;
             s Create a new account numbered A-655 that belongs to customer
                  “Jackson”;
                                     account.account-number := “A-655”;
                                     account.balance := 100;
                                     insert account
                                        where customer.customer-name = “Jackson”;




Database System Concepts, 1 st Ed.                     B.33   ©VNS InfoSolutions Private Limited, Varanasi, India 22100
Modification of an Existing Record
             s To modify an existing record of type <record type>, we must get that
                  record into the work-area template for <record type>, and change the
                  desired fields in that template.
             s Reflect the changes in the database by executing
                                             replace
             s replace dies not have <record type> as an argument; the record that
                  is affected is the one to which the currency pointer points.
             s DL/I requires that, prior to a record being modified, the get command
                  must have the additional clause hold, so that the system is aware that
                  a record is to be modified.




Database System Concepts, 1 st Ed.                  B.34   ©VNS InfoSolutions Private Limited, Varanasi, India 22100
Example Query
             s Change the street address of Boyd to Northview:
                                     get hold first customer
                                          where customer.customer-name = “Boyd”;
                                     customer.customer-street := “Northview”;
                                     replace;
             s If there were more than one record containing Boyd’s address, the
                  program would have included a loop to search all Boyd records.




Database System Concepts, 1 st Ed.                     B.35   ©VNS InfoSolutions Private Limited, Varanasi, India 22100
Deletion of a Record
             s To delete a record of type <record type>, set the currency pointer to
                  point to that record and execute delete.
             s As a record modification, the get command must have the attribute
                  hold attached to it. Example: Delete account A-561:
                                     get hold first account
                                        where account.account-number = “A-561”;
                                     delete;
             s A delete operation deletes not only the record in question, but also
                  the entire subtree rooted by that record. Thus, to delete customer
                  Boyd and all his accounts, we write
                                     get gold first customer
                                        where customer.customer-name = “Boyd”;
                                     delete;




Database System Concepts, 1 st Ed.                     B.36   ©VNS InfoSolutions Private Limited, Varanasi, India 22100
Virtual Records
             s For many-to-many relationships, record replication is necessary to
                  preserve the tree-structure organization of the database.
                    q   Data inconsistency may result when updating takes place
                    q   Waste of space is unavoidable
             s Virtual record — contains no data value, only a logical pointer to a
                  particular physical record.
             s When a record is to be replicated in several database trees, a single
                  copy of that record is kept in one of the trees and all other records are
                  replaced with a virtual record.
             s 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.




Database System Concepts, 1 st Ed.                  B.37   ©VNS InfoSolutions Private Limited, Varanasi, India 22100
Virtual Records (Cont.)
             s Eliminate data replication in the diagram shown on page B.11; create
                  virtual-customer and virtual-account.
             s Replace account with virtual-account in the first tree, and replace
                  customer with virtual-customer in the second tree.
             s 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.




Database System Concepts, 1 st Ed.                 B.38   ©VNS InfoSolutions Private Limited, Varanasi, India 22100
Sample Database




Database System Concepts, 1 st Ed.         B.39   ©VNS InfoSolutions Private Limited, Varanasi, India 22100
Mapping Hierarchies to Files
             s Implementations of hierarchical databases do not use
                  parent-to-child pointers, since these would require the use of variable-
                  length records.

             s Can use leftmost-child and next-sibling pointers which allow each
                  record to contain exactly two pointers.
                    q   The leftmost-child pointer points to one child.
                    q   The next-sibling pointer points to another child of the same parent.




Database System Concepts, 1 st Ed.                    B.40   ©VNS InfoSolutions Private Limited, Varanasi, India 22100
Mapping Hierarchies to Files (Cont.)
             s Implementation with parent-child pointers.




             s Implementation with leftmost child and next-sibling pointers.




Database System Concepts, 1 st Ed.               B.41   ©VNS InfoSolutions Private Limited, Varanasi, India 22100
Mapping Hierarchies to Files (Cont.)
             s In general, the final child of a parent has no next sibling; rather than
                  setting the next-sibling filed to null, place a pointer (or preorder thread)
                  that points to the next record in preorder.
             s Using preorder threads allows us to process a tree instance in
                  preorder simply by following pointers.




Database System Concepts, 1 st Ed.                   B.42    ©VNS InfoSolutions Private Limited, Varanasi, India 22100
Mapping Hierarchies to Files (Cont.)
             s May add a third child-to-parent pointer which facilitates the processing
                  of queries that give a value for a child record and request a value from
                  the corresponding parent record.
             s the parent-child relationship within a hierarchy is analogous to the
                  owner-member relationship within a DBTG set.
                    q   A one-to-many relationship is being represented.
                    q   Store together the members and the owners of a set occurrence.
                    q   Store physically close on disk the child records and their parent.
                    q   Such storage allows a sequence of get first, get next, and
                        get next within parent statements to e executed with a
                        minimal number of block accesses.




Database System Concepts, 1 st Ed.                   B.43    ©VNS InfoSolutions Private Limited, Varanasi, India 22100
The IMS Database System
             s IBM Information Management System — first developed in the late
                  1960s; historically among the largest databases.
             s Issue queries through embedded calls which are part of the IMS
                  database language DL/I.
             s Allows the database designer a broad number of options in the data-
                  definition language.
                    q   Designer defines a physically hierarchy as the database schema.
                    q   Can define several subschemas (or view) by constructing a logical
                        hierarchy from the record types constituting the schema.
                    q   Options such as block sizes, special pointer fields, and so on,
                        allow the database administrator to tune the system.




Database System Concepts, 1 st Ed.                   B.44   ©VNS InfoSolutions Private Limited, Varanasi, India 22100
Record Access Schemes
             s Hierarchical sequential-access method (HSAM) — used for physically
                  sequential files (such as tape files). Records are stored physically in
                  preorder.
             s Hierarchical indexed-sequential-access method (HISAM) — an index-
                  sequential organization at the root level of the hierarchy.
             s Hierarchical indexed-direct-access method (HIDAM) — index
                  organization at the root level with pointers to child records.
             s Hierarchical direct-access method (HDAM) — similar to HIDAM, but
                  with hashed access at the root level.




Database System Concepts, 1 st Ed.                  B.45    ©VNS InfoSolutions Private Limited, Varanasi, India 22100
IMS Concurrency Control
             s Early versions handled concurrency control by permitting only one
                  update application program to run at a time. Read-only applications
                  could run concurrent with updates.
             s Later versions included a program-isolation feature
                    q   Allowed for improved concurrency control
                    q   Offered more sophisticated transaction-recovery techniques (such
                        as logging); important to online transactions.
             s The need for high-performance transaction processing led to the
                  introduction of IMS Fast Path.




Database System Concepts, 1 st Ed.                 B.46   ©VNS InfoSolutions Private Limited, Varanasi, India 22100
IMS Fast Path
             s Uses an alternative physical data organization that allows the most
                  active parts of the database to reside in main memory.
             s Instead of updates to disk being forced at the end of a transaction,
                  update is deferred until a checkpoint or synchronization point.
             s In the event of a crash, the recovery subsystem must redo all
                  committed transactions whose updates were not forced to disk.
             s Allows for extremely high rates of transaction throughput.
             s Forerunner of main-memory database systems.




Database System Concepts, 1 st Ed.                 B.47   ©VNS InfoSolutions Private Limited, Varanasi, India 22100
Sample Database




Database System Concepts, 1 st Ed.         B.48   ©VNS InfoSolutions Private Limited, Varanasi, India 22100
Sample Database Corresponding to
                 Diagram of Figure B.4




Database System Concepts, 1 st Ed.   B.49   ©VNS InfoSolutions Private Limited, Varanasi, India 22100
Sample Database Corresponding To
                Diagram of Figure B.8b




Database System Concepts, 1 st Ed.   B.50   ©VNS InfoSolutions Private Limited, Varanasi, India 22100
Tree-Structure Diagram With
                     Many-To-Many Relationships




Database System Concepts, 1 st Ed.   B.51   ©VNS InfoSolutions Private Limited, Varanasi, India 22100
E-R Diagram and Its Corresponding
                 Tree-Structure Diagrams




Database System Concepts, 1 st Ed.   B.52   ©VNS InfoSolutions Private Limited, Varanasi, India 22100
Sample Database Corresponding To
              Diagram of Figure B.12b




Database System Concepts, 1 st Ed.   B.53   ©VNS InfoSolutions Private Limited, Varanasi, India 22100
New Database Tree




Database System Concepts, 1 st Ed.          B.54   ©VNS InfoSolutions Private Limited, Varanasi, India 22100
New Database Tree




Database System Concepts, 1 st Ed.          B.55   ©VNS InfoSolutions Private Limited, Varanasi, India 22100
Class-enrollment E-R Diagram




Database System Concepts, 1 st Ed.   B.56   ©VNS InfoSolutions Private Limited, Varanasi, India 22100
Parent–Child E-R Diagram




Database System Concepts, 1 st Ed.     B.57   ©VNS InfoSolutions Private Limited, Varanasi, India 22100
Car-insurance E-R Diagram




Database System Concepts, 1 st Ed.    B.58   ©VNS InfoSolutions Private Limited, Varanasi, India 22100

More Related Content

Viewers also liked

7. Relational Database Design in DBMS
7. Relational Database Design in DBMS7. Relational Database Design in DBMS
7. Relational Database Design in DBMSkoolkampus
 
VNSISPL_DBMS_Concepts_AppC
VNSISPL_DBMS_Concepts_AppCVNSISPL_DBMS_Concepts_AppC
VNSISPL_DBMS_Concepts_AppCsriprasoon
 
Data and information
Data and informationData and information
Data and informationKARUPPUSAMI
 
A Hierarchical Model of Reviews for Aspect-based Sentiment Analysis
A Hierarchical Model of Reviews for Aspect-based Sentiment AnalysisA Hierarchical Model of Reviews for Aspect-based Sentiment Analysis
A Hierarchical Model of Reviews for Aspect-based Sentiment AnalysisSebastian Ruder
 
Hierarchical data models in Relational Databases
Hierarchical data models in Relational DatabasesHierarchical data models in Relational Databases
Hierarchical data models in Relational Databasesnavicorevn
 
Relational algebra in dbms
Relational algebra in dbmsRelational algebra in dbms
Relational algebra in dbmsshekhar1991
 
The return of the hierarchical model
The return of the hierarchical modelThe return of the hierarchical model
The return of the hierarchical modelJukka Zitting
 

Viewers also liked (9)

7. Relational Database Design in DBMS
7. Relational Database Design in DBMS7. Relational Database Design in DBMS
7. Relational Database Design in DBMS
 
VNSISPL_DBMS_Concepts_AppC
VNSISPL_DBMS_Concepts_AppCVNSISPL_DBMS_Concepts_AppC
VNSISPL_DBMS_Concepts_AppC
 
Data and information
Data and informationData and information
Data and information
 
A Hierarchical Model of Reviews for Aspect-based Sentiment Analysis
A Hierarchical Model of Reviews for Aspect-based Sentiment AnalysisA Hierarchical Model of Reviews for Aspect-based Sentiment Analysis
A Hierarchical Model of Reviews for Aspect-based Sentiment Analysis
 
Hierarchical data models in Relational Databases
Hierarchical data models in Relational DatabasesHierarchical data models in Relational Databases
Hierarchical data models in Relational Databases
 
Relational algebra in dbms
Relational algebra in dbmsRelational algebra in dbms
Relational algebra in dbms
 
Types dbms
Types dbmsTypes dbms
Types dbms
 
The return of the hierarchical model
The return of the hierarchical modelThe return of the hierarchical model
The return of the hierarchical model
 
Dbms slides
Dbms slidesDbms slides
Dbms slides
 

Similar to VNSISPL_DBMS_Concepts_AppB

VNSISPL_DBMS_Concepts_ch7
VNSISPL_DBMS_Concepts_ch7VNSISPL_DBMS_Concepts_ch7
VNSISPL_DBMS_Concepts_ch7sriprasoon
 
VNSISPL_DBMS_Concepts_ch2
VNSISPL_DBMS_Concepts_ch2VNSISPL_DBMS_Concepts_ch2
VNSISPL_DBMS_Concepts_ch2sriprasoon
 
VNSISPL_DBMS_Concepts_ch9
VNSISPL_DBMS_Concepts_ch9VNSISPL_DBMS_Concepts_ch9
VNSISPL_DBMS_Concepts_ch9sriprasoon
 
VNSISPL_DBMS_Concepts_ch4
VNSISPL_DBMS_Concepts_ch4VNSISPL_DBMS_Concepts_ch4
VNSISPL_DBMS_Concepts_ch4sriprasoon
 
Vnsispl dbms concepts_ch3
Vnsispl dbms concepts_ch3Vnsispl dbms concepts_ch3
Vnsispl dbms concepts_ch3sriprasoon
 
VNSISPL_DBMS_Concepts_ch24
VNSISPL_DBMS_Concepts_ch24VNSISPL_DBMS_Concepts_ch24
VNSISPL_DBMS_Concepts_ch24sriprasoon
 
VNSISPL_DBMS_Concepts_ch12
VNSISPL_DBMS_Concepts_ch12VNSISPL_DBMS_Concepts_ch12
VNSISPL_DBMS_Concepts_ch12sriprasoon
 
VNSISPL_DBMS_Concepts_ch20
VNSISPL_DBMS_Concepts_ch20VNSISPL_DBMS_Concepts_ch20
VNSISPL_DBMS_Concepts_ch20sriprasoon
 
VNSISPL_DBMS_Concepts_ch8
VNSISPL_DBMS_Concepts_ch8VNSISPL_DBMS_Concepts_ch8
VNSISPL_DBMS_Concepts_ch8sriprasoon
 
CBSE XII Database Concepts And MySQL Presentation
CBSE XII Database Concepts And MySQL PresentationCBSE XII Database Concepts And MySQL Presentation
CBSE XII Database Concepts And MySQL PresentationGuru Ji
 
DATABASE MANAGEMENT SYSTEM-MRS. LAXMI B PANDYA FOR 25TH AUGUST,2022.pptx
DATABASE MANAGEMENT SYSTEM-MRS. LAXMI B PANDYA FOR 25TH AUGUST,2022.pptxDATABASE MANAGEMENT SYSTEM-MRS. LAXMI B PANDYA FOR 25TH AUGUST,2022.pptx
DATABASE MANAGEMENT SYSTEM-MRS. LAXMI B PANDYA FOR 25TH AUGUST,2022.pptxLaxmi Pandya
 
Vector_db_introduction.pptx
Vector_db_introduction.pptxVector_db_introduction.pptx
Vector_db_introduction.pptxDataChest
 
No sql – rise of the clusters
No sql – rise of the clustersNo sql – rise of the clusters
No sql – rise of the clustersresponseteam
 
VNSISPL_DBMS_Concepts_ch21
VNSISPL_DBMS_Concepts_ch21VNSISPL_DBMS_Concepts_ch21
VNSISPL_DBMS_Concepts_ch21sriprasoon
 
Introduction To DBMS
Introduction To DBMSIntroduction To DBMS
Introduction To DBMSrafat_mentor
 

Similar to VNSISPL_DBMS_Concepts_AppB (20)

VNSISPL_DBMS_Concepts_ch7
VNSISPL_DBMS_Concepts_ch7VNSISPL_DBMS_Concepts_ch7
VNSISPL_DBMS_Concepts_ch7
 
VNSISPL_DBMS_Concepts_ch2
VNSISPL_DBMS_Concepts_ch2VNSISPL_DBMS_Concepts_ch2
VNSISPL_DBMS_Concepts_ch2
 
VNSISPL_DBMS_Concepts_ch9
VNSISPL_DBMS_Concepts_ch9VNSISPL_DBMS_Concepts_ch9
VNSISPL_DBMS_Concepts_ch9
 
VNSISPL_DBMS_Concepts_ch4
VNSISPL_DBMS_Concepts_ch4VNSISPL_DBMS_Concepts_ch4
VNSISPL_DBMS_Concepts_ch4
 
Vnsispl dbms concepts_ch3
Vnsispl dbms concepts_ch3Vnsispl dbms concepts_ch3
Vnsispl dbms concepts_ch3
 
VNSISPL_DBMS_Concepts_ch24
VNSISPL_DBMS_Concepts_ch24VNSISPL_DBMS_Concepts_ch24
VNSISPL_DBMS_Concepts_ch24
 
VNSISPL_DBMS_Concepts_ch12
VNSISPL_DBMS_Concepts_ch12VNSISPL_DBMS_Concepts_ch12
VNSISPL_DBMS_Concepts_ch12
 
VNSISPL_DBMS_Concepts_ch20
VNSISPL_DBMS_Concepts_ch20VNSISPL_DBMS_Concepts_ch20
VNSISPL_DBMS_Concepts_ch20
 
VNSISPL_DBMS_Concepts_ch8
VNSISPL_DBMS_Concepts_ch8VNSISPL_DBMS_Concepts_ch8
VNSISPL_DBMS_Concepts_ch8
 
Databases
DatabasesDatabases
Databases
 
DBMS
DBMSDBMS
DBMS
 
CBSE XII Database Concepts And MySQL Presentation
CBSE XII Database Concepts And MySQL PresentationCBSE XII Database Concepts And MySQL Presentation
CBSE XII Database Concepts And MySQL Presentation
 
All About Database v1.1
All About Database  v1.1All About Database  v1.1
All About Database v1.1
 
DATABASE MANAGEMENT SYSTEM-MRS. LAXMI B PANDYA FOR 25TH AUGUST,2022.pptx
DATABASE MANAGEMENT SYSTEM-MRS. LAXMI B PANDYA FOR 25TH AUGUST,2022.pptxDATABASE MANAGEMENT SYSTEM-MRS. LAXMI B PANDYA FOR 25TH AUGUST,2022.pptx
DATABASE MANAGEMENT SYSTEM-MRS. LAXMI B PANDYA FOR 25TH AUGUST,2022.pptx
 
Vector_db_introduction.pptx
Vector_db_introduction.pptxVector_db_introduction.pptx
Vector_db_introduction.pptx
 
No sql – rise of the clusters
No sql – rise of the clustersNo sql – rise of the clusters
No sql – rise of the clusters
 
Ch2
Ch2Ch2
Ch2
 
VNSISPL_DBMS_Concepts_ch21
VNSISPL_DBMS_Concepts_ch21VNSISPL_DBMS_Concepts_ch21
VNSISPL_DBMS_Concepts_ch21
 
Introduction To DBMS
Introduction To DBMSIntroduction To DBMS
Introduction To DBMS
 
Ch02 3133
Ch02 3133Ch02 3133
Ch02 3133
 

More from sriprasoon

VNSISPL_DBMS_Concepts_ch25
VNSISPL_DBMS_Concepts_ch25VNSISPL_DBMS_Concepts_ch25
VNSISPL_DBMS_Concepts_ch25sriprasoon
 
VNSISPL_DBMS_Concepts_ch23
VNSISPL_DBMS_Concepts_ch23VNSISPL_DBMS_Concepts_ch23
VNSISPL_DBMS_Concepts_ch23sriprasoon
 
VNSISPL_DBMS_Concepts_ch17
VNSISPL_DBMS_Concepts_ch17VNSISPL_DBMS_Concepts_ch17
VNSISPL_DBMS_Concepts_ch17sriprasoon
 
VNSISPL_DBMS_Concepts_ch16
VNSISPL_DBMS_Concepts_ch16VNSISPL_DBMS_Concepts_ch16
VNSISPL_DBMS_Concepts_ch16sriprasoon
 
VNSISPL_DBMS_Concepts_ch15
VNSISPL_DBMS_Concepts_ch15VNSISPL_DBMS_Concepts_ch15
VNSISPL_DBMS_Concepts_ch15sriprasoon
 
VNSISPL_DBMS_Concepts_ch14
VNSISPL_DBMS_Concepts_ch14VNSISPL_DBMS_Concepts_ch14
VNSISPL_DBMS_Concepts_ch14sriprasoon
 
VNSISPL_DBMS_Concepts_ch11
VNSISPL_DBMS_Concepts_ch11VNSISPL_DBMS_Concepts_ch11
VNSISPL_DBMS_Concepts_ch11sriprasoon
 
VNSISPL_DBMS_Concepts_ch5
VNSISPL_DBMS_Concepts_ch5VNSISPL_DBMS_Concepts_ch5
VNSISPL_DBMS_Concepts_ch5sriprasoon
 
Inventory Management
Inventory ManagementInventory Management
Inventory Managementsriprasoon
 

More from sriprasoon (9)

VNSISPL_DBMS_Concepts_ch25
VNSISPL_DBMS_Concepts_ch25VNSISPL_DBMS_Concepts_ch25
VNSISPL_DBMS_Concepts_ch25
 
VNSISPL_DBMS_Concepts_ch23
VNSISPL_DBMS_Concepts_ch23VNSISPL_DBMS_Concepts_ch23
VNSISPL_DBMS_Concepts_ch23
 
VNSISPL_DBMS_Concepts_ch17
VNSISPL_DBMS_Concepts_ch17VNSISPL_DBMS_Concepts_ch17
VNSISPL_DBMS_Concepts_ch17
 
VNSISPL_DBMS_Concepts_ch16
VNSISPL_DBMS_Concepts_ch16VNSISPL_DBMS_Concepts_ch16
VNSISPL_DBMS_Concepts_ch16
 
VNSISPL_DBMS_Concepts_ch15
VNSISPL_DBMS_Concepts_ch15VNSISPL_DBMS_Concepts_ch15
VNSISPL_DBMS_Concepts_ch15
 
VNSISPL_DBMS_Concepts_ch14
VNSISPL_DBMS_Concepts_ch14VNSISPL_DBMS_Concepts_ch14
VNSISPL_DBMS_Concepts_ch14
 
VNSISPL_DBMS_Concepts_ch11
VNSISPL_DBMS_Concepts_ch11VNSISPL_DBMS_Concepts_ch11
VNSISPL_DBMS_Concepts_ch11
 
VNSISPL_DBMS_Concepts_ch5
VNSISPL_DBMS_Concepts_ch5VNSISPL_DBMS_Concepts_ch5
VNSISPL_DBMS_Concepts_ch5
 
Inventory Management
Inventory ManagementInventory Management
Inventory Management
 

Recently uploaded

Millenials and Fillennials (Ethical Challenge and Responses).pptx
Millenials and Fillennials (Ethical Challenge and Responses).pptxMillenials and Fillennials (Ethical Challenge and Responses).pptx
Millenials and Fillennials (Ethical Challenge and Responses).pptxJanEmmanBrigoli
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxlancelewisportillo
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management systemChristalin Nelson
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfVanessa Camilleri
 
ROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxVanesaIglesias10
 
Presentation Activity 2. Unit 3 transv.pptx
Presentation Activity 2. Unit 3 transv.pptxPresentation Activity 2. Unit 3 transv.pptx
Presentation Activity 2. Unit 3 transv.pptxRosabel UA
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4MiaBumagat1
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptxmary850239
 
TEACHER REFLECTION FORM (NEW SET........).docx
TEACHER REFLECTION FORM (NEW SET........).docxTEACHER REFLECTION FORM (NEW SET........).docx
TEACHER REFLECTION FORM (NEW SET........).docxruthvilladarez
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfJemuel Francisco
 
Dust Of Snow By Robert Frost Class-X English CBSE
Dust Of Snow By Robert Frost Class-X English CBSEDust Of Snow By Robert Frost Class-X English CBSE
Dust Of Snow By Robert Frost Class-X English CBSEaurabinda banchhor
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxHumphrey A Beña
 
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...JojoEDelaCruz
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parentsnavabharathschool99
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptxmary850239
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)lakshayb543
 

Recently uploaded (20)

YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptxYOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
 
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptxLEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
 
Paradigm shift in nursing research by RS MEHTA
Paradigm shift in nursing research by RS MEHTAParadigm shift in nursing research by RS MEHTA
Paradigm shift in nursing research by RS MEHTA
 
Millenials and Fillennials (Ethical Challenge and Responses).pptx
Millenials and Fillennials (Ethical Challenge and Responses).pptxMillenials and Fillennials (Ethical Challenge and Responses).pptx
Millenials and Fillennials (Ethical Challenge and Responses).pptx
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management system
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdf
 
ROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptx
 
Presentation Activity 2. Unit 3 transv.pptx
Presentation Activity 2. Unit 3 transv.pptxPresentation Activity 2. Unit 3 transv.pptx
Presentation Activity 2. Unit 3 transv.pptx
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx
 
TEACHER REFLECTION FORM (NEW SET........).docx
TEACHER REFLECTION FORM (NEW SET........).docxTEACHER REFLECTION FORM (NEW SET........).docx
TEACHER REFLECTION FORM (NEW SET........).docx
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
 
Dust Of Snow By Robert Frost Class-X English CBSE
Dust Of Snow By Robert Frost Class-X English CBSEDust Of Snow By Robert Frost Class-X English CBSE
Dust Of Snow By Robert Frost Class-X English CBSE
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
 
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parents
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
 

VNSISPL_DBMS_Concepts_AppB

  • 1. Chapter B: Hierarchical Model s Basic Concepts s Tree-Structure Diagrams s Data-Retrieval Facility s Update Facility s Virtual Records s Mapping of Hierarchies to Files s The IMS Database System Database System Concepts, 1 st Ed. B.1 ©VNS InfoSolutions Private Limited, Varanasi, India 22100
  • 2. Basic Concepts s A hierarchical database consists of a collection of records which are connected to one another through links. s a record is a collection of fields, each of which contains only one data value. s A link is an association between precisely two records. s The hierarchical model differs from the network model in that the records are organized as collections of trees rather than as arbitrary graphs. Database System Concepts, 1 st Ed. B.2 ©VNS InfoSolutions Private Limited, Varanasi, India 22100
  • 3. Tree-Structure Diagrams s The schema for a hierarchical database consists of q boxes, which correspond to record types q lines, which correspond to links s Record types are organized in the form of a rooted tree. q No cycles in the underlying graph. q Relationships formed in the graph must be such that only one-to-many or one-to-one relationships exist between a parent and a child. Database System Concepts, 1 st Ed. B.3 ©VNS InfoSolutions Private Limited, Varanasi, India 22100
  • 4. General Structure s A parent may have an arrow pointing to a child, but a child must have an arrow pointing to its parent. Database System Concepts, 1 st Ed. B.4 ©VNS InfoSolutions Private Limited, Varanasi, India 22100
  • 5. Tree-Structure Diagrams (Cont.) s Database schema is represented as a collection of tree-structure diagrams. q single instance of a database tree q The root of this tree is a dummy node q The children of that node are actual instances of the appropriate record type s When transforming E-R diagrams to corresponding tree-structure diagrams, we must ensure that the resulting diagrams are in the form of rooted trees. Database System Concepts, 1 st Ed. B.5 ©VNS InfoSolutions Private Limited, Varanasi, India 22100
  • 6. Single Relationships Database System Concepts, 1 st Ed. B.6 ©VNS InfoSolutions Private Limited, Varanasi, India 22100
  • 7. Single relationships (Cont.) s Example E-R diagram with two entity sets, customer and account, related through a binary, one-to-many relationship depositor. s Corresponding tree-structure diagram has q the record type customer with three fields: customer-name, customer-street, and customer-city. q the record type account with two fields: account-number and balance q the link depositor, with an arrow pointing to customer Database System Concepts, 1 st Ed. B.7 ©VNS InfoSolutions Private Limited, Varanasi, India 22100
  • 8. Single Relationships (Cont.) s If the relationship depositor is one to one, then the link depositor has two arrows. s Only one-to-many and one-to-one relationships can be directly represented in the hierarchical mode. Database System Concepts, 1 st Ed. B.8 ©VNS InfoSolutions Private Limited, Varanasi, India 22100
  • 9. Transforming Many-To-Many Relationships s Must consider the type of queries expected and the degree to which the database schema fits the given E-R diagram. s In all versions of this transformation, the underlying database tree (or trees) will have replicated records. Database System Concepts, 1 st Ed. B.9 ©VNS InfoSolutions Private Limited, Varanasi, India 22100
  • 10. Many-To Many Relationships (Cont.) Database System Concepts, 1 st Ed. B.10 ©VNS InfoSolutions Private Limited, Varanasi, India 22100
  • 11. Many-To-Many Relationships (Cont.) s Create two tree-structure diagrams, T1, with the root customer, and T2, with the root account. s In T1, create depositor, a many-to-one link from account to customer. s In T2, create account-customer, a many-to-one link from customer to account. Database System Concepts, 1 st Ed. B.11 ©VNS InfoSolutions Private Limited, Varanasi, India 22100
  • 12. Sample Database Database System Concepts, 1 st Ed. B.12 ©VNS InfoSolutions Private Limited, Varanasi, India 22100
  • 13. General Relationships s Example ternary E-R diagram and corresponding tree-structure diagrams are shown on the following page. Database System Concepts, 1 st Ed. B.13 ©VNS InfoSolutions Private Limited, Varanasi, India 22100
  • 14. Sample Ternary Databases. (a) T 1 (b) T 2 Database System Concepts, 1 st Ed. B.14 ©VNS InfoSolutions Private Limited, Varanasi, India 22100
  • 15. Several Relationships s To correctly transform an E-R diagram with several relationships, split the unrooted tree structure diagrams into several diagrams, each of which is a rooted tree. s Example E-R diagram and transformation leading to diagram that is not a rooted tree: Database System Concepts, 1 st Ed. B.15 ©VNS InfoSolutions Private Limited, Varanasi, India 22100
  • 16. Several Relationships (Cont.) Database System Concepts, 1 st Ed. B.16 ©VNS InfoSolutions Private Limited, Varanasi, India 22100
  • 17. Several Relationships (Cont.) s Corresponding diagrams in the form of rooted trees. Database System Concepts, 1 st Ed. B.17 ©VNS InfoSolutions Private Limited, Varanasi, India 22100
  • 18. Several Relationships (2nd Example) s Diagram (b) contains a cycle. s Replicate all three record types, and create two separate diagrams. Database System Concepts, 1 st Ed. B.18 ©VNS InfoSolutions Private Limited, Varanasi, India 22100
  • 19. Several Relationships (2nd Example) s Each diagram is now a rooted tree. Database System Concepts, 1 st Ed. B.19 ©VNS InfoSolutions Private Limited, Varanasi, India 22100
  • 20. Data Retrieval Facility s We present querying of hierarchical databases via a simplified version of DL/I, the data-manipulation language of IMS. s Example schema: customer-account-branch s A branch can have several customers, each of which can have several accounts. s An account may belong to only one customer, and a customer can belong to only one branch. Database System Concepts, 1 st Ed. B.20 ©VNS InfoSolutions Private Limited, Varanasi, India 22100
  • 21. Example Schema Database System Concepts, 1 st Ed. B.21 ©VNS InfoSolutions Private Limited, Varanasi, India 22100
  • 22. Program Work Area s A buffer storage area that contains these variables q Record templates q Currency pointers q Status flag s A particular program work area is associated with precisely one application program. s Example program work area: q Templates for three record types: customer, account, and branch. q Currency pointer to the most recently accessed record of branch, customer, or account type. q One status variable. Database System Concepts, 1 st Ed. B.22 ©VNS InfoSolutions Private Limited, Varanasi, India 22100
  • 23. The get Command s Data items are retrieved through the get command q locates a record in the database and sets the currency pointer to point to it q copies that record from the database to the appropriate program work-area template s The get command must specify which of the database trees is to be searched. s State of the program work area after executing get command to locate the customer record belonging to Freeman q The currency pointer points now to the record of Freeman. q The information pertaining to Freeman is copied into the customer record work-area template. q DB-status is set to the value 0. Database System Concepts, 1 st Ed. B.23 ©VNS InfoSolutions Private Limited, Varanasi, India 22100
  • 24. The get Command (Cont.) s To scan all records in a consistent manner, we must impose an ordering on the records. s Preorder search starts at the root, and then searches the subtrees of the root from left to right, recursively. q Starts at the root, visits the leftmost child, visits its leftmost child, and so on, until a leaf (childless) node is reached. q Move back to the parent of the leaf and visit the leftmost unvisited child. q Proceed in this manner until the entire three is visited. s Preordered listing of the records in the example database three: Parkview, Fleming, A-522, A-561, Freeman, A533, Seashore, Boyd, A-409, A-622 Database System Concepts, 1 st Ed. B.24 ©VNS InfoSolutions Private Limited, Varanasi, India 22100
  • 25. Access Within A Database Tree s Locates the first record (in preorder), of type <record type> that satisfies the <condition> of the where clause. s The where clause is optional <condition> is a predicate that involves either an ancestor of <record type> or the <record type> itself. s If where is omitted, locate the first record of type <record-type> q Set currency pointer to that record q Copy its contents into the appropriate work-area template. s If no such record exists in the tree, then the search fails, and DB-status is set to an appropriate error message. Database System Concepts, 1 st Ed. B.25 ©VNS InfoSolutions Private Limited, Varanasi, India 22100
  • 26. Example Queries s Print the address of customer Fleming: get first customer where customer.customer-name = “Fleming”; print (customer.customer-address); s Print an account belonging to Fleming that has a balance greater than $10,000. get first account where customer.customer-name = “Fleming”; and account.balance > 10000; if DB-status = 0 then print (account.account-number); Database System Concepts, 1 st Ed. B.26 ©VNS InfoSolutions Private Limited, Varanasi, India 22100
  • 27. Access Within a Database Tree (Cont.) get next <record type> where <condition> s Locates the next record (in preorder) that satisfies <condition>. s If the where clause is omitted, then the next record of type <record type> is located. s The currency pointer is used by the system to determine where to resume the search. s As before, the currency pointer, the work-area template of type <record- type>, and DB-status are affected. Database System Concepts, 1 st Ed. B.27 ©VNS InfoSolutions Private Limited, Varanasi, India 22100
  • 28. Example Query s Print the account number of all the accounts that have a balance greater than $500 get first account where account.balance > 500; while DB-status = 0 do begin print (account.account-number); get next account where account.balance > 500; end s When while loop returns DB-status ≠ 0, we exhausted all account records with account.balance > 500. Database System Concepts, 1 st Ed. B.28 ©VNS InfoSolutions Private Limited, Varanasi, India 22100
  • 29. Access Within a Database Tree (Cont.) get next within parent <record type> where <condition> s Searches only the specific subtree whose root is the most recent record that was located with either get first or get next. s Locates the next record (in preorder) that satisfies <condition> in the subtree whose root is the parent of current of <record type>. s If the where clause is omitted, then the next record of type <record type> within the designated subtree to resume search. s Use currency pointer to determine where to resume search. s DB-status is set to a nonzero value if no such record exists in the designated subtree (rather than if none exists in the entire tree). Database System Concepts, 1 st Ed. B.29 ©VNS InfoSolutions Private Limited, Varanasi, India 22100
  • 30. Example Query s Print the total balance of all accounts belonging to Boyd: sum := 0; get first customer where customer.customer-name = “Boyd”; get next within parent account; while DB-status = 0 do begin sum = sum + account.balance; get next within parent account; end print (sum); s We exit from the while loop and print out the value of sum only when the DB-status is set to a value not equal to 0. This value exists after the get next within parent operation fails. Database System Concepts, 1 st Ed. B.30 ©VNS InfoSolutions Private Limited, Varanasi, India 22100
  • 31. Update Facility s Various mechanisms are available for updating information in the database. s Creation and deletion of records (via the insert and delete operations). s Modification (via the replace operation) of the content of existing records. Database System Concepts, 1 st Ed. B.31 ©VNS InfoSolutions Private Limited, Varanasi, India 22100
  • 32. Creation of New Records s To insert <record type> into the database, first set the appropriate values in the corresponding <record type> work-area template. Then execute insert <record type> where <condition> s If the where clause is included, the system searches the database three (in preorder) for a record that satisfies the <condition> in the where clause. s Once such a record — say, X —is found, the newly created record is inserted in the tree as the leftmost child of X. s If where is omitted, the record is inserted in the first position (in preorder) in the tree where <record type> can be inserted in accordance with the specified schema. Database System Concepts, 1 st Ed. B.32 ©VNS InfoSolutions Private Limited, Varanasi, India 22100
  • 33. Example Queries s Add a new customer, Jackson, to the Seashore branch: customer.customer-name := “Jackson”; customer.customer-street := “Old Road”; customer.customer-city := “Queens”; insert customer where branch.branch-name = “Seashore”; s Create a new account numbered A-655 that belongs to customer “Jackson”; account.account-number := “A-655”; account.balance := 100; insert account where customer.customer-name = “Jackson”; Database System Concepts, 1 st Ed. B.33 ©VNS InfoSolutions Private Limited, Varanasi, India 22100
  • 34. Modification of an Existing Record s To modify an existing record of type <record type>, we must get that record into the work-area template for <record type>, and change the desired fields in that template. s Reflect the changes in the database by executing replace s replace dies not have <record type> as an argument; the record that is affected is the one to which the currency pointer points. s DL/I requires that, prior to a record being modified, the get command must have the additional clause hold, so that the system is aware that a record is to be modified. Database System Concepts, 1 st Ed. B.34 ©VNS InfoSolutions Private Limited, Varanasi, India 22100
  • 35. Example Query s Change the street address of Boyd to Northview: get hold first customer where customer.customer-name = “Boyd”; customer.customer-street := “Northview”; replace; s If there were more than one record containing Boyd’s address, the program would have included a loop to search all Boyd records. Database System Concepts, 1 st Ed. B.35 ©VNS InfoSolutions Private Limited, Varanasi, India 22100
  • 36. Deletion of a Record s To delete a record of type <record type>, set the currency pointer to point to that record and execute delete. s As a record modification, the get command must have the attribute hold attached to it. Example: Delete account A-561: get hold first account where account.account-number = “A-561”; delete; s A delete operation deletes not only the record in question, but also the entire subtree rooted by that record. Thus, to delete customer Boyd and all his accounts, we write get gold first customer where customer.customer-name = “Boyd”; delete; Database System Concepts, 1 st Ed. B.36 ©VNS InfoSolutions Private Limited, Varanasi, India 22100
  • 37. Virtual Records s For many-to-many relationships, record replication is necessary to preserve the tree-structure organization of the database. q Data inconsistency may result when updating takes place q Waste of space is unavoidable s Virtual record — contains no data value, only a logical pointer to a particular physical record. s When a record is to be replicated in several database trees, a single copy of that record is kept in one of the trees and all other records are replaced with a virtual record. s 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. Database System Concepts, 1 st Ed. B.37 ©VNS InfoSolutions Private Limited, Varanasi, India 22100
  • 38. Virtual Records (Cont.) s Eliminate data replication in the diagram shown on page B.11; create virtual-customer and virtual-account. s Replace account with virtual-account in the first tree, and replace customer with virtual-customer in the second tree. s 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. Database System Concepts, 1 st Ed. B.38 ©VNS InfoSolutions Private Limited, Varanasi, India 22100
  • 39. Sample Database Database System Concepts, 1 st Ed. B.39 ©VNS InfoSolutions Private Limited, Varanasi, India 22100
  • 40. Mapping Hierarchies to Files s Implementations of hierarchical databases do not use parent-to-child pointers, since these would require the use of variable- length records. s Can use leftmost-child and next-sibling pointers which allow each record to contain exactly two pointers. q The leftmost-child pointer points to one child. q The next-sibling pointer points to another child of the same parent. Database System Concepts, 1 st Ed. B.40 ©VNS InfoSolutions Private Limited, Varanasi, India 22100
  • 41. Mapping Hierarchies to Files (Cont.) s Implementation with parent-child pointers. s Implementation with leftmost child and next-sibling pointers. Database System Concepts, 1 st Ed. B.41 ©VNS InfoSolutions Private Limited, Varanasi, India 22100
  • 42. Mapping Hierarchies to Files (Cont.) s In general, the final child of a parent has no next sibling; rather than setting the next-sibling filed to null, place a pointer (or preorder thread) that points to the next record in preorder. s Using preorder threads allows us to process a tree instance in preorder simply by following pointers. Database System Concepts, 1 st Ed. B.42 ©VNS InfoSolutions Private Limited, Varanasi, India 22100
  • 43. Mapping Hierarchies to Files (Cont.) s May add a third child-to-parent pointer which facilitates the processing of queries that give a value for a child record and request a value from the corresponding parent record. s the parent-child relationship within a hierarchy is analogous to the owner-member relationship within a DBTG set. q A one-to-many relationship is being represented. q Store together the members and the owners of a set occurrence. q Store physically close on disk the child records and their parent. q Such storage allows a sequence of get first, get next, and get next within parent statements to e executed with a minimal number of block accesses. Database System Concepts, 1 st Ed. B.43 ©VNS InfoSolutions Private Limited, Varanasi, India 22100
  • 44. The IMS Database System s IBM Information Management System — first developed in the late 1960s; historically among the largest databases. s Issue queries through embedded calls which are part of the IMS database language DL/I. s Allows the database designer a broad number of options in the data- definition language. q Designer defines a physically hierarchy as the database schema. q Can define several subschemas (or view) by constructing a logical hierarchy from the record types constituting the schema. q Options such as block sizes, special pointer fields, and so on, allow the database administrator to tune the system. Database System Concepts, 1 st Ed. B.44 ©VNS InfoSolutions Private Limited, Varanasi, India 22100
  • 45. Record Access Schemes s Hierarchical sequential-access method (HSAM) — used for physically sequential files (such as tape files). Records are stored physically in preorder. s Hierarchical indexed-sequential-access method (HISAM) — an index- sequential organization at the root level of the hierarchy. s Hierarchical indexed-direct-access method (HIDAM) — index organization at the root level with pointers to child records. s Hierarchical direct-access method (HDAM) — similar to HIDAM, but with hashed access at the root level. Database System Concepts, 1 st Ed. B.45 ©VNS InfoSolutions Private Limited, Varanasi, India 22100
  • 46. IMS Concurrency Control s Early versions handled concurrency control by permitting only one update application program to run at a time. Read-only applications could run concurrent with updates. s Later versions included a program-isolation feature q Allowed for improved concurrency control q Offered more sophisticated transaction-recovery techniques (such as logging); important to online transactions. s The need for high-performance transaction processing led to the introduction of IMS Fast Path. Database System Concepts, 1 st Ed. B.46 ©VNS InfoSolutions Private Limited, Varanasi, India 22100
  • 47. IMS Fast Path s Uses an alternative physical data organization that allows the most active parts of the database to reside in main memory. s Instead of updates to disk being forced at the end of a transaction, update is deferred until a checkpoint or synchronization point. s In the event of a crash, the recovery subsystem must redo all committed transactions whose updates were not forced to disk. s Allows for extremely high rates of transaction throughput. s Forerunner of main-memory database systems. Database System Concepts, 1 st Ed. B.47 ©VNS InfoSolutions Private Limited, Varanasi, India 22100
  • 48. Sample Database Database System Concepts, 1 st Ed. B.48 ©VNS InfoSolutions Private Limited, Varanasi, India 22100
  • 49. Sample Database Corresponding to Diagram of Figure B.4 Database System Concepts, 1 st Ed. B.49 ©VNS InfoSolutions Private Limited, Varanasi, India 22100
  • 50. Sample Database Corresponding To Diagram of Figure B.8b Database System Concepts, 1 st Ed. B.50 ©VNS InfoSolutions Private Limited, Varanasi, India 22100
  • 51. Tree-Structure Diagram With Many-To-Many Relationships Database System Concepts, 1 st Ed. B.51 ©VNS InfoSolutions Private Limited, Varanasi, India 22100
  • 52. E-R Diagram and Its Corresponding Tree-Structure Diagrams Database System Concepts, 1 st Ed. B.52 ©VNS InfoSolutions Private Limited, Varanasi, India 22100
  • 53. Sample Database Corresponding To Diagram of Figure B.12b Database System Concepts, 1 st Ed. B.53 ©VNS InfoSolutions Private Limited, Varanasi, India 22100
  • 54. New Database Tree Database System Concepts, 1 st Ed. B.54 ©VNS InfoSolutions Private Limited, Varanasi, India 22100
  • 55. New Database Tree Database System Concepts, 1 st Ed. B.55 ©VNS InfoSolutions Private Limited, Varanasi, India 22100
  • 56. Class-enrollment E-R Diagram Database System Concepts, 1 st Ed. B.56 ©VNS InfoSolutions Private Limited, Varanasi, India 22100
  • 57. Parent–Child E-R Diagram Database System Concepts, 1 st Ed. B.57 ©VNS InfoSolutions Private Limited, Varanasi, India 22100
  • 58. Car-insurance E-R Diagram Database System Concepts, 1 st Ed. B.58 ©VNS InfoSolutions Private Limited, Varanasi, India 22100