MySQL Introduction (1) – database understanding


In production and life, we often use database for information storage and operation, so we must have a certain understanding of it, in order to use it skillfully.

1. What is a database?

  1. A container (usually a file or group of files) for holding organized data
  2. A structured list of a particular type
  3. Columns and data types
    The table consists of columns. Column stores some information in the table.
    A field in a column table
    Data type allowed by data type. Each table column has a corresponding data class type, which limits (or allows) the data stored in that column.
  4. A record in the row table
    The data of the table is stored in rows, and each saved record is stored in its own row. Think of the table as a grid, the vertical column of the grid as a table column, and the horizontal row as a table row.
  5. Primary key a column (or a group of columns) whose value can uniquely distinguish each row in the table
    The primary key should meet the following requirements:
    Any two lines do not have the same primary key value;
    Each row must have a primary key value (null values are not allowed for primary key columns).

2. Types of databases

In the early days, there were three popular database models: hierarchical database, network database and relational database. In today’s Internet, there are two most commonly used database models, namelyRelational databaseandNon relational database

3. What is a relational database

Relational database model is to reduce complex data structure to simple binary relation (i.e. two-dimensional table form)

  1. MySQL and Oracle databases are the most commonly used in Internet operation and maintenance
  2. Storing data through SQL structured query statement
  3. Strong consistency, acid theoretical system.


MySQL has existed for a long time. Because of its small size, fast speed, low total cost of ownership, open source code and other advantages, it has been widely installed and used in the world.

MySQL is one of the most important open-source relational database software in the Internet field, which is popular among users. It is developed and maintained by MySQL AB company in Sweden. 2006. MySQL AB company was acquired by Sun company. In 2008, Sun company was acquired by Oracle company, the big man in the field of traditional data database. Therefore, MySQL database software belongs to Oracle company and becomes another database product in the field of traditional database. After Oracle company acquired mysql, its market share in the field of commercial database and open source software jumped The first place, such a pattern, caused many people’s concerns, which directly led to the birth and development of later MySQL branch database MariaDB.

5. Non relational database (NoSQL)

Non relational database is also called NoSQL database, which means “not olly SQL”
It refers to non relational database, not “no SQL”. Therefore, the production of NoSQL is not to completely deny non relational database, but as an effective supplement to traditional relational database. NoSQL database can play an unimaginable high efficiency and performance in a specific scenario.
High performance, high concurrency and low requirements for data consistency
Open source NoSQL systems, such as Cassandra from Facebook and HBase from Apache, have also been widely recognized. Redis and mongb are also increasingly popular and sought after by all kinds of small and medium-sized companies
Summary of NoSQL non relational database:
1. NoSQL is not a negation of relational database, but an important supplement of relational database
2. NoSQL is generated for high performance and high concurrency, ignoring the functions affecting high performance and high concurrency
3. Typical NoSQL products: memcached (pure memory), redis (persistent cache), mongodb (document database)

6. Classification of non relational database

1. Key value database
Key value database is similar to the hash table used in traditional languages. Data can be added, queried or deleted through key. Because key key access is used, high performance and scalability will be achieved
The key value database mainly uses a hash table, in which a specific key and a pointer point to a specific data. The advantage of key / value model for it system is simple, easy to deploy and high concurrency

Typical products: memcached, redis, memcachedb, BerkeleyDB

2. Document oriented database
Document oriented databases will be stored as documents. Each document is a self-contained data unit, a collection of data items. Each data item has a name and corresponding value. The value can be either a simple data type, such as string, number and date, or a complex type, such as sequence table and relation object. The minimum unit of data storage is document. Document attributes stored in the same table can be different. Data can be stored in multiple forms such as XML, JSON or jsonb

Typical products: mongodb, CouchDB

3. Column oriented database

4. Graph database

Recommended Today

Understanding and deepening of relative path and absolute path

What is relative path and absolute path Last week’s report solved some problems, but also exposed many problems, one of which is the relative path and absolute path. For PHP using xampp to build a server, the relative path refers to the current file relative to the user’s access, and the absolute path refers to […]