Database. The DB an objective form of representation of a data set systematized so that these data were found and processed using a computer. The addressing databases is performed using the database management system. Databases are applied in all spheres of human activity.
Classification of databases
Separate flat databases in which all information is had in the only table in which each entry contains the identifier of a specific object and relational databases consisting of several tables between which connection is established with the help of matching values of the fields of the same name. now there are several different models of data view which, did not gain such wide circulation among developers and users yet as a relational model. So by development of systems of management of databases, the relational model de facto is the standard. In general on data representation form of the database separate into the following categories:
Relations between tables
The relations between tables establish connection between the data which are in different tables of a relational database.
- One - to - one
If between two tables there is a relation one - to - one, then it means that each entry in one table corresponds only to one entry in other table.
When the object described in one of tables is related to several records of other table, there is a "one-to-many" relation. This type of the relation between tables most often meets at design of structure of databases.
- Much to - much
At the relation between two tables of much to - much each entry in one table is connected with several entries in other table. For convenience of work with the tables having such relations usually add one more table which is in the one-to-many relation and much to - one to the corresponding tables to the database.
Normalization of databases
All information which is contained in base can be placed in one table, but such data structure is inefficient as in this table there will be many repeating data. Such data structure will lead to the following problems:
- availability of the repeating data will lead to unjustified increase in file size of the database. Except irrational use of disk space, it will also cause noticeable deceleration of operation of application;
- input by the user of a large number of the repeating information inevitably will lead to emergence of errors;
- change of one of often used parameters will demand considerable efforts on correction of each record containing these data.
Process of reduction of redundancy of information in the database by means of its separation into slightly tables connected with each other is also called normalization of data. There are six levels of normalization of the database which received the name of normal forms.
- The first normal form
- prohibits the repeating columns (containing identical information on sense);
- prohibits the multiple columns (containing values of type of the list);
- requires to define primary key for the table, i.e. that column or a combination of columns which unambiguously define every line.
- The second normal form
The second normal form requires that non-key columns of tables depended on primary key in general, but not on its part. If the table is in the first normal form and the primary key at it consists of one column, then it is also in the second normal form.
- The third normal form
That the table was in the third normal form, it is necessary that non-key columns in it depended only on primary key. The most widespread situation in this context are settlement columns which values can be received by any manipulations with other columns of the table. For reduction of the table in the third normal form such columns need to be deleted from tables.
- Normal form of Boyce-Kodda
The normal form of Boyce-Kodda requires that in the table there was only one potential primary key. Most often at the tables which are in the third normal form and happens, but not always. If the second column (a combination of columns) allowing to identify unambiguously a line was detected, then for reduction to a normal form of Boyce-Kodda such data should be taken out in the separate table.
- The fourth normal form
For reduction of the table which is in a normal form of Boyce-Kodda to the fourth normal form it is necessary to eliminate the multiple-valued dependences which are available in it. So to provide that the insert or removal of any line of the table would not require modification of other lines of the same table.
- The fifth normal form
Formal determination of the fifth normal form is as follows: it is a form in which dependences of connection are eliminated. In most cases practical benefits of normalization of tables to the fifth normal form are not observed. Normalization of the database allows to eliminate redundancy, duplication of data. As a result, the probability of emergence of conflicting data is considerably reduced, administration of base and updating of information in it is facilitated, the amount of disk space is reduced. Often, to take information from the normalized database, it is necessary to design very advanced queries which increase load of system resources because of a large number of connections of tables. Therefore to increase an access rate of data and to simplify programming of requests, quite often it is necessary to go on a selective denormalization of base.
Keys and indexes
In relational databases of the table communicate with each other by means of matching values of key fields. Any field in the table can practically be a key field. The key can be primary or external. The primary key unambiguously defines entry in the table while the foreign key is used for communication with primary key of other table. Some of the main requirements, shown to database management systems, are a possibility of data view in certain, other than physical, an order and a possibility of quick search of a certain record. An effective remedy of the solution of these tasks is use of indexes. The index represents the table which contains the key values for each entry in the data table written in the order required for the user. Key values are defined on the basis of one or several fields of the table. Besides, the index contains unique references to the corresponding entries in the table.
It is curious that the name of one of the Al-Quaeda terrorist groups, most known in the world, in translation from Arabic is meant by Database. The origin of this name is caused by strict accounting of information about organization members.