GRML -> Articles -> Databases ->

Databases Model Overview

Introduction.

A database model is used to structure and organize information in a database. There are different types of models, used by databases. This is an overview of them.

Different database models.

For any logical model, of a database, there are different, possible, physical implementations. One example is the relational model.

In larger systems, the physical implementation often has indices pointing to the data. This is similar to some aspects, of common implementations, of the network model. In small relational databases, the data is often stored in a set of files. Each file has one table, in a flat, unindexed structure.

Flat model.

The flat, or table, model consists of a single, two-dimensional array of data elements. All members, of a given column, are assumed to be similar values. All members, of a row, are assumed to be related to one another.

For instance, columns for 'name' and 'password' are used as a part of a system security database. Each row has a specific password associated with a specific user. Columns, of the table, have a type associated with them. It defines them as character data, date or time information, integers, or floating point numbers. This model is the basis of the spreadsheet.

Network model.

The network model allows multiple datasets to be used together, through the use of pointers (or references). Some columns contain pointers to different tables, instead of data. Thus, the tables are related by references. Each is similar to a network structure.

A particular subset, of the network model, is the hierarchical model. It limits the relationships to a tree structure. This contrasts the more general, directed, graph structure implied by the full network model.

Relational model.

The relational model was introduced in an academic paper (http://www.acm.org/classics/nov95/toc.html) by E. F. Codd, in 1970. It was a way to make database management systems independent of any particular application. It is a mathematical model, using predicate logic and set theory.

The basic idea, of relational database management systems, has been very popular. However, relatively few people understand the mathematical definition. Fewer understand the obscure DBMSs implementation of it completely, and without extension.

Oracle, for example, is used in a purely relational way. However, it allows tables to be defined, allowing duplicate rows. This is an extension, or violation, of the relational model.

Relational model at work.

In layman's terms, a DBMS is called relational, if it supports relational operations. This is regardless of whether it enforces strict adherence, to the relational model. The following is an informal, non-technical explanation of how "relational" database management systems commonly work.

A relational database contains multiple tables. Each is similar to the one in the "flat" database model. However, unlike network databases, the tables are not linked by pointers. Instead, "keys" are used to match rows of data, in different tables.

Keys.

A key is one, or more, column(s) in a table. Use any column, in a table, as a key. Or, group multiple columns together, to create a single key. Unlike pointers, it's not necessary to define all the keys in advance. A column is used as a key, whether or not it was originally intended to be.

When a key, consists of data, with an external, real-world meaning (such as a person's name, a book's ISBN, or a car's serial number), it's called a "natural" key. If no natural key is suitable, use an arbitrary key (such as by giving employees ID numbers).

In practice, most databases have both generated and natural keys. Generated keys are used internally to create links, between unbreakable rows. Natural keys are used, less reliably, for searches and for integration with other databases.

For example, consider records, in two independently developed databases. These databases are matched by social security number. This is true except when the social security numbers are incorrect, missing, or have changed.

Requesting data.

Request data, from a relational database, by sending it a query written in a special language. Usually, it is a dialect of SQL. Although SQL was originally intended for end-users, it's much more common for SQL queries to be embedded into software. The goal is to provide an user interface without knowing SQL. (Many web sites perform SQL queries when generating web pages.)

In response to a query, the database returns a result set. This is just a list of rows, containing the results. The simplest query is to return all rows from a table. More often, the rows are filtered, in some way, to return only a few results.

In SQL, combine data, from multiple tables, with a "join". Conceptually, this is done by first taking all possible combinations of rows (the "cross-product"). Next, filter everything, except the desired result(s).

In practice, relational database management systems rewrite ("optimize") queries to perform faster. They use a variety of techniques. With a "join", the primary optimisation is obtained using indices. This prevents building a complete cross-product, which is otherwise necessary.

Conclusion.

The flexibility, of the relational model, allows database programmers to write queries not anticipated by database designers. As a result, relational databases are used by multiple applications, in ways the original designers did not foresee.

This is especially important for databases in use for decades. This has made the idea, and implementation, of relational databases popular with businesses.


Copyright © 2002-2010 grmlbrowser.com. All Rights Reserved. Privacy Policy | Slimming aids

free pics images | LCD vs Plasma | lamp projection TV | good credit score | Lawn Mower Parts

Photo Recovery Mac | 32 inch LCD TV | Recover Data | Recover Deleted Files | best web hosting