Joomla includes support for storing and retrieving hierarchical information in the form of nested sets in database tables. This is used in the implementation of menus and categories in the core Joomla CMS from version 1.6 onwards.
In the nested sets model, each data item is stored as a row in the database table in the normal manner. However, additional columns (like "lft" for left, "rgt" for right) are present in the table to express the hierarchical relationship between the data items.
Each data item is referred to as a node and the collection of nodes can be thought of as forming a tree. Nodes can have zero, one or many child nodes. A node that has no children is referred to as a leaf node. A child node can itself have children and this nesting can carry on to arbitrary depth. The table is assumed to hold a single tree with a single node being allocated as the root node.
Generally, Joomla database table that uses nested sets include a number of standard columns:These are:-
lft: Item id of the item to the left
rgt: Item id of the item to the right