Database Systems - Document Data Types - JSON and XML - Structured vs. Unstructured Data - APPFICIAL

preview_player
Показать описание
Document types

Structured data – Data that is the easy to search and organize, because it is usually contained in rows and columns and its elements can be mapped into fixed pre-defined fields, such as a table that has structured data or even an Excel spreadsheet.

Unstructured data - data that cannot be contained in a row-column database and doesn’t have an associated data model. Most of the data in the world is unstructured. For example, the contents of an email.

Semistructured data is a mix between structured and unstructured data. The type of data defined as semi-structured data has some defining or consistent characteristics but doesn’t conform to a structure as rigid as is expected with a relational database. A document such as JSON or XML is used to store semistructured data.

JSON stands for JavaScript Object Notation, and is a human-readable collection of data that we can access in a really logical manner.

JSON represents data in several ways ways:
String — characters enclosed in double quotes
Number — digits (integer or floating-point)
Boolean — true or false (as strings)
Null — the string null
Object: a collection of name-value (or key-value) pairs. An object is defined within left ({) and right (}) braces. Each name-value pair begins with the name, followed by a colon, followed by the value. Name-value pairs are comma separated.
Array: an ordered collection of values. An array is defined within left ([) and right (]) brackets. Items in the array are comma separated.

Example:

var people = [{
"name" : ”Bob",
"age" : "24",
"gender" : "male”
},
{
"name" : ”Mary",
"age" : ”51",
"gender" : ”female”
}];

XML is a markup language created by the World Wide Web Consortium (W3C) to define a syntax for encoding documents that both humans and machines could read. XML stands for eXtensible Markup Language, and surrounds data (called elements) with tags similar to HTML tags, but are custom named. Tags are enclosed in angled brackets. The first line of an XML document is called the declaration, which includes the XML version and character encoding. XML is popular because it is readable, flexible, and hierarchical.

Most relational databases support JSON and XML types but may vary based on their format and capabilities. MySQL supports JSON and provides lots of functions for manipulating JSON VALUES such as JSON_ARRAY() to format string or numeric data as a JSON array, and JSON_EXTRACT() which returns the data from a JSON document.

Subscribe to Appficial for more programming videos coming soon. Also, don't forget to click LIKE and comment on the video if it helped you out!
Рекомендации по теме