GATE CS 2015 · Set-2 · SQL Queries

NAT · 1 mark · Problem DBMS-SQL-0297

Consider the following B+ tree index of order 1 (every node holds one or two keys):Root: [9]. Its children, left to right, are the internal nodes [5] and [13, 17].The children of [5], left to right, are the leaves [3] and [5, 7].The children of [13, 17], left to right, are the leaves [9, 11], [13, 15] and [17, 20].The leaves are linked left to right in this order: [3], [5, 7], [9, 11], [13, 15], [17, 20].The minimum number of nodes (including the Root node) that must be fetched in order to satisfy the following query: "Get all records with a search key greater than or equal to 7 and less than 15" is

Numerical answer (NAT).

Solve it on GATE DA practice →More Relational Model & SQL problems

Show the worked solution\[\boxed{\text{nodes} = \text{root-to-leaf path for the low key} + \text{further leaves along the chain}}\]Search for 7: root [9] \(\to\) [5] \(\to\) leaf [5, 7]: 3 nodes.Then follow the leaf links: [9, 11] and [13, 15] (13 is in range; 15 stops the scan): 2 more leaves.\(3 + 2 = 5\).Answer: 5

GATE DA practice: past exam problems by chapter, with worked solutions · gatedaprep.com