N1QL provides SQL-like Query experience for NoSQL Databases

Source: Internet
Author: User
Let's take a look at the data model. Since 1990s, with the popularity of graphic interface applications and Web applications, most commercial applications use the object-oriented development model. For

Let's take a look at the data model. Since 1990s, with the popularity of graphic interface applications and Web applications, most commercial applications use the object-oriented development model. For

Relational databases have been popular for more than 40 years. In this process, SQL has become the standard for operating relational databases. SQL encapsulates and abstracts data storage methods so that developers can focus on program logic. The simplification of developers' work is also why SQL and even relational databases are popular.

Society is developing, and data is changing. Data generated from data sources such as social networks, scientific research, and Iot is no longer limited to a fixed structure. Therefore, relational databases that are good at structured data are hard to process.

It is best to have a fixed schema for relational databases, which also makes it difficult to agile and quickly iterate to meet modern business requirements. Dynamic schema not only requires us to rethink data models and databases, but also requires a new query language to read the data.

Data Model

Let's take a look at the data model. Since 1990s, with the popularity of graphic interface applications and Web applications, most commercial applications use the object-oriented development model. For Web applications, JSON represents the standard of data objects, and JSON files are exchanged between servers and applications. NoSQL databases became popular around two thousand years ago. The purpose of NoSQL databases is to facilitate the storage and management of JSON files.

JSON databases are very popular with developers because they represent data and other object-oriented programming languages such as Java, C ++, and ,. NET, Python, and Ruby are the same and can have a flexible schema. However, file database developers have always lacked easy-to-use query languages.

The lack of file database query languages puts developers in a dilemma: either enjoying JSON flexible data models or relational database SQL, but both of them cannot have a combination.

Query Language

N1QL is a query language that introduces SQL into the file database. Technically speaking, JSON is a data model that does not conform to the first paradigm, while N1QL operates on this data model. N1QL expands operations on traditional SQL tables and rows to JSON (nested files ).

Introducing SQL into JSON is a bit like changing the power of automotive oil. Although the engine is changed, the driver's operation method remains unchanged. Currently, developers can use familiar SQL statements to operate and dynamically expand the application schema.

Is a simple example of the join statement in SQL and N1QL. To learn more about N1QL, go to Couchbase.

The advantage of extending SQL rather than completely re-creating a language is that the classic keyword operator sorting set in SQL can be reused. This greatly reduces the threshold for developers to use N1QL.

However, the models of relational databases and file databases are different, so N1QL also has something new. For example, N1QL introduces the NEST and UNNEST keywords to set or break down nested objects, is null and is missing to process dynamic schemas, and ARRAY functions to traverse or filter ARRAY elements.

The flexibility of the new data model combined with the powerful functions of the query language familiar to developers lay a good foundation for the next generation of more flexible and powerful application development. Developers can enjoy the file database through niyun!

N1QL brings SQL to NoSQL databases

Translator/Liu xukun's review/Zhu zhenggui's editor/Zhong Hao

From: CSDN

This article permanently updates the link address:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.