Difference between revisions of "Databases"

From Suhrid.net Wiki
Jump to navigationJump to search
Line 14: Line 14:
 
* XML consists of tagged elements which can be nested, attributes of elements and the text (values/data)
 
* XML consists of tagged elements which can be nested, attributes of elements and the text (values/data)
 
* XML document can be thought of as a tree with values/text forming the leaves.
 
* XML document can be thought of as a tree with values/text forming the leaves.
 +
 +
== Relational vs XML ==
 +
 +
{|
 +
!
 +
! Relational
 +
! XML
 +
|-
 +
|Structure
 +
|Tables
 +
|Hierarchical/Tree
 +
|-
 +
|Schema
 +
|Fixed in advance
 +
|Flexible, self-describing. e.g. all elements need not have same attributes. (In relational, we would need to have NULL values). Inconsistencies in the structure is NOT a problem.
 +
|-
 +
|Queries
 +
| Relatively simple
 +
| Complicated compared to Relational / SQL.
 +
|-
 +
|Ordering
 +
| Fundamentally UNORDERED. e.g. Order by clause is required in SQL in case order is desired.
 +
| Ordering is implied - e.g. the way the text is laid out in the XML document.
 +
|-
 +
|Implementation
 +
|
 +
|15.00
 +
|}

Revision as of 23:27, 7 December 2013

Relational Databases

  • Set of named relations (tables)
  • Each relation has a set of named attributes (columns)
  • Each tuple (row) has a value for each attribute
  • Each attribute has a type (or domain)
  • All queries return relations (tables), so it can said to be compositional or closed.

XML Data

  • Alternative to relational model to store data
  • Standard for data representation and exchange
  • Document format similar to HTML, however tags represent content instead of formatting.
  • XML consists of tagged elements which can be nested, attributes of elements and the text (values/data)
  • XML document can be thought of as a tree with values/text forming the leaves.

Relational vs XML

Relational XML
Structure Tables Hierarchical/Tree
Schema Fixed in advance Flexible, self-describing. e.g. all elements need not have same attributes. (In relational, we would need to have NULL values). Inconsistencies in the structure is NOT a problem.
Queries Relatively simple Complicated compared to Relational / SQL.
Ordering Fundamentally UNORDERED. e.g. Order by clause is required in SQL in case order is desired. Ordering is implied - e.g. the way the text is laid out in the XML document.
Implementation 15.00