A "storage box" takes you into the world of database

A "storage box" takes you into the world of database

I. Introduction

1.1 hero - Data era, the future has come

Today, we already "entered the IT era DT era," Ma also said: future resource is not oil, not gas, but "data." This is because, in the information technology era iteration so fast, will produce a variety of large amounts of data, information, then the attendant question is: how do we achieve safe, efficient storage, retrieval and management of data?

Data era, the effective storage of data, efficient access to facilitate the sharing and security control has become a problem to be solved at present.

1.2 leads to the problem - how to solve the problem?

We use the example of a life to lead to the solution of the problem.

In general, every household will have a lot of debris, which may be many species, the numbers are more, then we can think of using one or more of the warehouse, or a store room, even if it is the storage box to store these items. Thus, we can think of, for more and more, increasingly complex data, you can also create your own storage space for them, and make management easy and efficient, and this will be the storage space can be defined as "database." .

The database is used to store a wide variety, many jumbled "data". Below we explain the specific definition of the basic concepts of database and data structure and the type of database.

Second, the basic idea of ​​the database

2.1 The concept of a database

Database, from simple terms, can be considered a collection of tables. The table by different organizations together to form the recording, the recording is based on the "OK" as the structural unit of the data, one record corresponds a "rows", we can call the entity; each of the tables one is a property of this table, otherwise known as a data item, also called field.

2.2 Structure Database

When it comes to the above, in fact, it is a collection of tables in the database, and the table is the combination of record, recorded by the field and entities.

(Table: recording different tissues together, to form a "table", is used to store data)

2.3 Data definition

Data: record descriptor is things, including numbers, text, graphics, images, sound files records; according to a unified format for storage in the form of "rows" in.

In fact, we can be simply understood as the data "need special meaning or value of information."

Third, the characteristics of the database

We can continue the above example of the storage box binding characteristics lead database. Storage box, mainly used to organize storing objects, we can be a relatively large storage box is divided into a plurality of sections, in which a stationery store where a store household items and so on, this could make us a certain extent, quick access when needed, easy to use.

Then bound to the database, the database is large storage box, various sections of the table is not the same variety, of which the article is inside a variety of data tables.

And such a configuration may also provide storage and exhibit characteristics database:

  1. Structured storage of large amount of data, to facilitate efficient search and access;
  2. Effective to maintain data consistency, integrity, reduce data redundancy;
  3. Sharing and security to meet the requirements of the application (storage box can be locked, only those with keys can be used)

Fourth, the type of database

4.1 database development process

History of the development of the database is relatively long, are interested you can find out.

Development of the database by classical data model (mesh - hierarchical - relationship) evolved.

Generally distinguished in the following manner:

4.2 database by storing types are divided into: a relational database, non-relational database

  1. Relational Database: stores the values, characters, strings, Boolean and so on;
  2. Non-relational databases: storage of pictures, video, voice and so on;

4.3 mainstream database list

Relational databases : mysql (oracle company), sql server (Microsoft Corporation) access (Microsoft) oracle (Oracle company) db2 (IBM company) sybase (sybase) - (one hundred million level support for concurrency, Spring Festival activities) which typically features model - "entity relationship" ( "ER") a: so in

Non-relational databases (the NoSQL) : MongoDB the Redis (database memory / cache database) to {KV key-value variable - value is stored} memcache (database memory / cache database) HBase (KV - value pairs)

4.2.2 non-relational database advantages:
  • Database meet high concurrent read and write;
  • Efficient mass data storage and access;
  • Highly scalable high availability

On Redis 4.3 and memcache similarities and differences (as everyone can understand simple)

  1. Similarities: a database storing heat (high frequency re-use)

  2. Different points: Redis can be done persistently saved, you can store objects (information stored in Java object), and memcache caching content data in memory easily lost

Supplementary points:

  • Redis database log file is mainly used for data recovery

  • Oracle database logs: redo log group (round robin written and synchronous backup database server)

Fifth, relational database

Relational database system is a database system based on the relational model, the relational model is applied to an instance of the database field.

5.1 What is a relational model?

Relationship model based on the theory of the relational algebra, which is what is called "entity - relationship" (ER) plans to direct representation, which includes entities, relationships and attributes three elements.

Entity: That is an example, corresponds to the real world can be distinguished from "events" or "things" other objects;

Properties: entity having a certain characteristic, an entity may have a plurality of attributes;

Contact: correspondence between the group consisting of a plurality of the same type and entity share the same properties.

It may not be particularly easy to understand, or to let simple example:

Entity - bank customer or bank account;

Properties - Bank customers name, address and contact information;

Contact - there is a relationship between the "savings" between bank customers and bank accounts.

Primary and foreign keys 5.2

Each row in the data table must be unique, and does not allow duplicate record appears, by defining the primary key (primary key, Primary Key) can guarantee the uniqueness of records.

Key, key, it is the relational model is a very important element.

5.2.1 Primary Key

Primary key uniquely identifies rows in the table, a row of data corresponding to the primary key. One or more primary key field, whose value is unique and is not allowed to take a null value. A table can have one primary key.

5.2.2 foreign keys

Foreign key is unique to a table and the other tables associated field, act as a restraint. Foreign key definitions are generally created in the field of time.

A foreign key in the table that is that the primary key of a table, not duplicate primary keys, foreign keys may be repeated;

NOTE: candidate keys: In addition to the primary keys and foreign keys

VI Summary

This article is by living in a storage box simple example to understand aspects of database concepts, classification, structure, function and characteristics of knowledge.

Guess you like

Origin blog.51cto.com/14557673/2463928