Database model
From Wikipedia, the free encyclopedia
It has been suggested that Types of DBMS be merged into this article. (Discuss)Proposed since
July 2015.
This article includes a list of references, but its sources remain unclear because it
has insufficient inline citations. Please help to improve this article by introducingmore
precise citations. (February 2014)
Collage of five types of database models
A database model is a type of data modelthat determines the logical structure of adatabase and fundamentally
determines in which manner data can be stored, organized, and manipulated. The most popular example of a
database model is the relational model, which uses a table-based format.
Flat model[edit]
Flat File Model
Main articles: Flat file database and Spreadsheet
The flat (or table) model consists of a single, two-dimensional array of data elements, where all members of a
given column are assumed to be similar values, and all members of a row are assumed to be related to one
another. For instance, columns for name and password that might be used as a part of a system security
database. Each row would have the specific password associated with an individual user. Columns of the table
often have a type associated with them, defining them as character data, date or time information, integers, or
floating point numbers. This tabular format is a precursor to the relational model.
Hierarchical model
Hierarchical Model
Main article: Hierarchical model
In a hierarchical model, data is organized into a tree-like structure, implying a single parent for each record. A
sort field keeps sibling records in a particular order. Hierarchical structures were widely used in the early
mainframe database management systems, such as the Information Management System (IMS) by IBM, and
now describe the structure of XMLdocuments. This structure allows one one-to-many relationship between two
types of data. This structure is very efficient to describe many relationships in the real world; recipes, table of
contents, ordering of paragraphs/verses, any nested and sorted information.
This hierarchy is used as the physical order of records in storage. Record access is done by navigating
downward through the data structure using pointers combined with sequential accessing. Because of this, the
hierarchical structure is inefficient for certain database operations when a full path (as opposed to upward link
and sort field) is not also included for each record. Such limitations have been compensated for in later IMS
versions by additional logical hierarchies imposed on the base physical hierarchy.
Network model
Network Model
Many to Many relationships
One child can have multiple parents
Main article: Network model
The network model expands upon the hierarchical structure, allowing many-to-many relationships in a tree-like
structure that allows multiple parents. It was most popular before being replaced by the relational model, and is
defined by theCODASYL specification.
The network model organizes data using two fundamental concepts, called records and sets. Records contain
fields (which may be organized hierarchically, as in the programming language COBOL). Sets (not to be
confused with mathematical sets) define one-to-many relationships between records: one owner, many
members. A record may be an owner in any number of sets, and a member in any number of sets.
A set consists of circular linked lists where one record type, the set owner or parent, appears once in each circle,
and a second record type, the subordinate or child, may appear multiple times in each circle. In this way a
hierarchy may be established between any two record types, e.g., type A is the owner of B. At the same time
another set may be defined where B is the owner of A. Thus all the sets comprise a general directed
graph (ownership defines a direction), or network construct. Access to records is either sequential (usually in
each record type) or by navigation in the circular linked lists.
The network model is able to represent redundancy in data more efficiently than in the hierarchical model, and
there can be more than one path from an ancestor node to a descendant. The operations of the network model
are navigational in style: a program maintains a current position, and navigates from one record to another by
following the relationships in which the record participates. Records can also be located by supplying key values.
Although it is not an essential feature of the model, network databases generally implement the set relationships
by means of pointers that directly address the location of a record on disk. This gives excellent retrieval
performance, at the expense of operations such as database loading and reorganization.
Popular DBMS products that utilized it were Cincom Systems' Total and Cullinet's IDMS. IDMS gained a
considerable customer base; in the 1980s, it adopted the relational model and SQL in addition to its original tools
and languages.
Most object databases (invented in the 1990s) use the navigational concept to provide fast navigation across
networks of objects, generally using object identifiers as "smart" pointers to related objects. Objectivity/DB, for
instance, implements named one-to-one, one-to-many, many-to-one, and many-to-many named relationships
that can cross databases. Many object databases also support SQL, combining the strengths of both models.
Relational model
Two tables with a relationship
Main article: Relational model
The relational model was introduced by E.F. Codd in 1970[1] as a way to make database management systems
more independent of any particular application. It is a mathematical model defined in terms of predicate
logicand set theory, and systems implementing it have been used by mainframe, midrange and microcomputer
systems.
The products that are generally referred to as relational databases in fact implement a model that is only an
approximation to the mathematical model defined by Codd. Three key terms are used extensively in relational
database models: relations,attributes, and domains. A relation is a table with columns and rows. The named
columns of the relation are called attributes, and the domain is the set of values the attributes are allowed to
take.
The basic data structure of the relational model is the table, where information about a particular entity (say, an
employee) is represented in rows (also called tuples) and columns. Thus, the "relation" in "relational database"
refers to the various tables in the database; a relation is a set of tuples. The columns enumerate the various
attributes of the entity (the employee's name, address or phone number, for example), and a row is an actual
instance of the entity (a specific employee) that is represented by the relation. As a result, each tuple of the
employee table represents various attributes of a single employee.
All relations (and, thus, tables) in a relational database have to adhere to some basic rules to qualify as
relations. First, the ordering of columns is immaterial in a table. Second, there can't be identical tuples or rows in
a table. And third, each tuple will contain a single value for each of its attributes.
A relational database contains multiple tables, each similar to the one in the "flat" database model. One of the
strengths of the relational model is that, in principle, any value occurring in two different records (belonging to
the same table or to different tables), implies a relationship among those two records. Yet, in order to enforce
explicit integrity constraints, relationships between records in tables can also be defined explicitly, by identifying
or non-identifying parent-child relationships characterized by assigning cardinality (1:1, (0)1:M, M:M). Tables can
also have a designated single attribute or a set of attributes that can act as a "key", which can be used to
uniquely identify each tuple in the table.
A key that can be used to uniquely identify a row in a table is called a primary key. Keys are commonly used to
join or combine data from two or more tables. For example, an Employee table may contain a column
named Location which contains a value that matches the key of a Location table. Keys are also critical in the
creation of indexes, which facilitate fast retrieval of data from large tables. Any column can be a key, or multiple
columns can be grouped together into a compound key. It is not necessary to define all the keys in advance; a
column can be used as a key even if it was not originally intended to be one.
A key that has an external, real-world meaning (such as a person's name, a book's ISBN, or a car's serial
number) is sometimes called a "natural" key. If no natural key is suitable (think of the many people
named Brown), an arbitrary or surrogate key can be assigned (such as by giving employees ID numbers). In
practice, most databases have both generated and natural keys, because generated keys can be used internally
to create links between rows that cannot break, while natural keys can be used, less reliably, for searches and
for integration with other databases. (For example, records in two independently developed databases could be
matched up by social security number, except when the social security numbers are incorrect, missing, or have
changed.)
The most common query language used with the relational model is the Structured Query Language (SQL).
Object-oriented database models
Object-Oriented Model
Main articles: Object-relational model and Object model
In the 1990s, the object-oriented programming paradigm was applied to database technology, creating a new
database model known as object databases. This aims to avoid theobject-relational impedance mismatch - the
overhead of converting information between its representation in the database (for example as rows in tables)
and its representation in the application program (typically as objects). Even further, the type system used in a
particular application can be defined directly in the database, allowing the database to enforce the same data
integrity invariants. Object databases also introduce the key ideas of object programming, such
as encapsulationand polymorphism, into the world of databases.
A variety of these ways have been tried[by whom?]for storing objects in a database. Some[which?] products have
approached the problem from the application programming end, by making the objects manipulated by the
program persistent. This typically requires the addition of some kind of query language, since conventional
programming languages do not have the ability to find objects based on their information content.
Others[which?] have attacked the problem from the database end, by defining an object-oriented data model for the
database, and defining a database programming language that allows full programming capabilities as well as
traditional query facilities.
Object databases suffered because of a lack of standardization: although standards were defined by ODMG,
they were never implemented well enough to ensure interoperability between products. Nevertheless, object
databases have been used successfully in many applications: usually specialized applications such as
engineering databases or molecular biology databases rather than mainstream commercial data processing.
However, object database ideas were picked up by the relational vendors and influenced extensions made to
these products and indeed to the SQL language.
An alternative to translating between objects and relational databases is to use an object-relational
mapping (ORM) library.
Complex
Manage
Understanding
What does Spatial Database mean?
A spatial database is a database that is enhanced to store and access spatial data or data that
defines a geometric space. These data are often associated with geographic locations and
features, or constructed features like cities. Data on spatial databases are stored as coordinates,
points, lines, polygons and topology. Some spatial databases handle more complex data like
three-dimensional objects, topological coverage and linear networks.
Revision Sheet
Understanding Database Models
A database model is a type of data model that determines the logical structure of a database,
fundamentally influencing how data can be stored, organized, and manipulated. The most popular example
is the relational model, which uses a table-based format. Other models include the flat model, hierarchical
model, network model, and object-oriented model, each with unique characteristics and uses.
Fill in the Blank: Fill in the blank with the correct words.
1. A _ model organizes data into a tree-like structure with a single parent for each record.
2. The _ model uses a table-based format and was introduced by E.F. Codd in 1970.
3. In the _ model, data is organized as a single two-dimensional array of data elements.
4. The _ model expands upon the hierarchical structure by allowing many-to-many relationships.
5. _ databases introduce encapsulation and polymorphism into databases.
Word bank: hierarchical, relational, flat, network, object-oriented
Multiple Choice Questions: Choose the correct answer from the
choices for each question.
1. Which database model allows one child to have multiple parents?
● a) Hierarchical
● b) Network
● c) Relational
● d) Flat
2. What is the primary key used for in a relational database?
● a) To store large amounts of data
● b) To uniquely identify a row in a table
● c) To create a graphical interface
● d) To connect to the internet
3. Which model is known for using encapsulation and polymorphism?
● a) Hierarchical
● b) Object-oriented
● c) Network
● d) Flat
4. What structure does the flat model use to organize data?
● a) Tree-like
● b) Two-dimensional array
● c) Circular linked lists
● d) Object-oriented
5. Which model was most popular before the relational model?
● a) Object-oriented
● b) Network
● c) Hierarchical
● d) Flat
Open-Ended Questions: Answer the following questions
1. Explain how the hierarchical model organizes data and give an example of where it might be
used.
2. Describe the main advantage of using the relational model over other database models.
3. Discuss how object-oriented databases aim to address the object-relational impedance
mismatch.
Answers
4. The hierarchical model organizes data into a tree-like structure where each record has a single
parent. An example use case is an organization's employee hierarchy, where each employee
reports to one manager.
5. The main advantage of the relational model is its ability to separate data from application logic,
allowing for more flexibility and easier management of data relationships.
6. Object-oriented databases address the object-relational impedance mismatch by allowing data to be
stored in the same format as it is used in applications, reducing the need for conversion and
maintaining data integrity.