SQL and NoSQL concepts (detailed introduction!!)

Find out the full name first

The full name of SQL is Structured query language, which is structured query language. It can be understood as a special programming language.

So what does nosql mean? The no here does not only mean not, but not only, so the full name of nosql should be Not Only Structured query language, that is, not only sql

SQL

Relational Database

The application scenarios of SQL are relational databases, such as Oracle and MySQL, which we commonly use. These are relational databases. When we understand a database, we often start with the structure of the table. The database stores tables one by one. The tables are composed of rows of data, and each row of data has fixed fields. I think everyone should be very familiar with this.

But why is it called a relational database instead of a table-structured database?

Because in a relational database, relationships are more important than table structures . The table structure is just a form, but what is the core design concept in the database? It is a relationship, a relationship between tables . This is why when we learn and design databases, we must start with the ER diagram, instead of talking about the methods of using the database or the details of the SQL language from the very beginning.

You can think about it, after we have established the database, we need to write SQL statements at this time. You may feel to some extent that the design of the database tables is closely related to the difficulty of writing SQL statements and the query performance of SQL statements. Relationships, and the process of designing a database is actually designing the relationships between tables in this database.

The question is, we know that the commonly used SQL database is a relational database, so what is the database represented by noSQL?

NoSQL

Why use Nosql?

With the rapid development and popularization of the Internet, the data generated by netizens while surfing the Internet is also increasing day by day, from GB to TB to PB. A large part of this data is processed by relational database management systems (RDBMS).
Due to the paradigm constraints, transaction characteristics, disk and other characteristics of relational databases, if the server uses a relational database, when a large amount of data is generated, the traditional relational database can no longer meet the needs of fast query and data insertion. The emergence of NoSQL solves this crisis. It improves performance by reducing data security, reducing support for transactions, and reducing support for complex queries. However, NSQL is still not the best candidate in some specific scenarios, such as some scenarios where transaction and security indicators are absolutely necessary.
 

What is NoSQL?

Regarding the concept of noSQL, one way of saying it is a non- relational database , and another way of saying it is a document database . I personally feel that neither of these two statements is very perfect when I understand it, but in comparison, the second statement is obviously better, because the first statement does not provide us with any information at all. The document here in a document database does not mean the meaning of a document as we conventionally understand it, but refers to the structure and core logic of data storage.

Unlike relational databases, the core of document databases is documents. Of course, the document here does not refer to documents in our usual sense, but data in json or xml format. Among current noSQL databases, json type data is more commonly used.

Each document contains pairs of fields and values. These values ​​can typically be of various types, including strings, numbers, booleans, arrays, or objects, and their structure is usually consistent with the objects developers use in their code. Due to the variety of field value types and powerful query languages, document databases are well suited to a wide variety of use cases and can be used as a general-purpose database. They can scale out to accommodate large amounts of data. According to [DB-Engines Ranking - popularity ranking of database management systems ), MongoDB has always been rated as the most popular NoSQL database in the world. It is a document database.

A key-value store is a simpler database in which each item contains a key and a value. Values ​​can usually only be retrieved by referencing the key, so learning how to query for specific key-value pairs is usually straightforward. Key-value databases are ideal for use cases where you need to store large amounts of data but don't need to perform complex queries to retrieve the data. Common use cases include storing user preferences or caching. Redis and DynanoDB are popular key-value databases.

おすすめ

転載: blog.csdn.net/weixin_52394141/article/details/132077720