Please enable JavaScript.
Coggle requires JavaScript to display documents.
Design Patterns of DataBases - Coggle Diagram
Design Patterns of DataBases
Tree
connected graph with no cycles
node is the root of a subtree
one less edge than nodes
two nodes connected on one path
tree - special case of graphs
Adjacency List Model
Data Manipulation
easy updating
difficult removal
remove childrens of a deleted node
easy adding
problem selection
choose item's direct descendants
representation of hierarchies
the single-table format
one column for the node's identifier
one column for the node's parent
representation of trees
the single-table format
the edge connection appears in the same table as the node
the two-table format
one table contains the graph's nodes
the other table contains the edges
each entry knows its immediate tree
Hierarchy
a directed tree
properties
subordination
inheritance
play many different roles
roles that filled by entities
hierarchy - special case of trees
Graph
diagram of
dots
edges
directed
flow in one direction
undirected
flow in both directions
join only two nodes
Nested Sets Model
a better model for trees and hierarchies
model a tree with left and right nested sets
Data Manipulation:
costly removing
recalculating of borders and ID
selection
simply calculate elements' ID
costly adding and editing
recalculating of the ID
reculculating the neighbors
restating of the corresponding fields
Materialized Path
Data manipulation
difficult editing
recalculate children's ID
selection - its strength
difficult adding
get parent’s path and add ID
removal
no violations of the tree integrity
stores the path from the root to each node as a string
the worst - to alter the tree's root
Closure Table
stores path from node to its descendants
Disadvantages
requires more database space
no easy way to build a sorted tree
necessary to store the links of elements with ancestors
necessary to store a link of each element to itself
Data Manipulation
eady editing
easy removing
easy adding
easy getting a subtree hierarchy
easy getting one descendant