N1QL is Couchbase's implementation of theSQL++ query language(or "SQL for JSON"). It is SQL-89 compatible, which means that most of your SQL queries also work on N1QL:
SELECT t.relation COUNT(*) AS count, AVG(c.age) AS avg_age
FROM tutorial t
UNNEST t.children c
WHERE c.age > 10
GROUP BY t.relation
HAVING COUNT(*) > 1
ORDER BY avg_age DESC
LIMIT 1 OFFSET 1
...
"adviseinfo": {
"current_indexes": [
{
"index_statement": "CREATE PRIMARY INDEX #primary ON 'tutorial'",
"keyspace_alias": "tutorial_t"
}
],
"recommended_indexes": {
"covering_indexes": [
{
"index_property": "GROUPBY & AGGREGATES pushdown",
"index_statement": "CREATE INDEX adv_ALL_children_age_relation ON 'tutorial'(ALL ARRAY 'c'.'age' FOR c IN 'children' END,'relation')",
"keyspace_alias": "tutorial_t"
}
],
"indexes": [
{
"index_statement": "CREATE INDEX adv_ALL_children_age ON 'tutorial'(ALL ARRAY 'c'.'age' FOR c IN 'children' END)",
"keyspace_alias": "tutorial_t",
"recommending_rule": "Index keys follow order of predicate types: 1. leading array index for unnest."
}
]
}
SELECT syntax | overview | grammar
JOIN syntax
INSERT | UPDATE | DELETE syntax
UPSERT | MERGE syntax
Data types
Operators
ANY, SOME, EVERY syntax
CASE, WHEN, THEN syntax
Functions
Arrayand Object functions
Dateand String functions
Type functions
User defined functions
Window functions andFunctions Overview
Subqueriesand Correlated Subqueries
CREATE INDEX syntax
In this panel, Mike Carey, UC Irvine Bren Professor of Computer and Information Sciences and Don Chamberlin, Co-Inventor of SQL discuss about how query is evolving to adapt to modern database demands, and what role SQL++ will have in the future of hybrid operational/analytical computing.
This free tutorial training, comprised of numerous video tutorials, demonstrations, and hands on lab exercises, teaches how to index, select, filter, aggregate, and calculate JSON data fields, and how to insert, update upsert, join, and delete JSON documents, within a Couchbase data bucket.
Couchbase Server 5.0 has language and performance improvements for pagination, index exploitation, integration, index availability, and more. Couchbase Server 5.5 will offer even more language and performance features for N1QL and global secondary indexes (GSI), including ANSI joins, aggregate performance, index partitioning, auditing, and more. We’ll give you an overview of the new features as well as practical use case examples.
Developer Advocate Matthew D. Groves talks about the history of SQL, its limitations and why SQL++ is necessary. This session is a gentle introduction to the key SQL++ concepts.
In this short video you will learn how to stress test your N1QL workloads with Apache JMeter.
The session provides a gentle introduction to N1QL for Analytics, the first commercial implementation of SQL++. We will cover the language features supported by the Couchbase Analytics Service and show you how easy it is for SQL users to transition to SQL++.