Query Data with SQL++
The Query Service supports the querying of data by means of the SQL++ query language.
As its primary function, the Query service enables you to issue queries to extract data from Couchbase server. You can also issue queries for data definition (defining indexes) and data manipulation (adding or deleting data). The Query Service needs both the Index Service and the Data Service to be running on Couchbase Server.
You can run queries from the Query workbench, the cbq shell, the REST API, or the Couchbase SDKs.
When to Use Queries
Use the Query service for query analysis and execution to help you build applications.
Use the Analytics service for online analytical processing (OLAP) — large datasets with complex analytical or ad hoc queries.
Use the Search service for full-text search with natural language processing across multiple data types and languages — custom text analysis, Geospatial search, and more.
SQL++ for Query
To create queries, you must use a query language that is structured so that the Query Service understands what it needs to retrieve. Couchbase Server uses a query language called SQL++. The Couchbase implementation of SQL++ was formerly known as N1QL (pronounced "nickel").
SQL++ is an expressive, powerful, and complete SQL dialect for querying, transforming, and manipulating JSON data. Based on SQL, it’s immediately familiar to developers who can quickly start developing rich applications.