N1QL
N1QL is a declarative query language designed for querying JSON data stored in Couchbase Server. It combines familiar SQL-like syntax with extensions tailored to JSON, enabling data retrieval, modification, and aggregation within a single language. N1QL is often described as SQL for JSON and is the primary query language for Couchbase’s data platform. It supports SELECT, INSERT, UPDATE, DELETE, and UPSERT operations.
N1QL queries are executed against buckets in Couchbase, with optional scopes and collections in newer versions.
Query planning and performance rely on indexes. Primary indexes enable arbitrary queries, but performance often requires
N1QL integrates with Couchbase components such as the query service, the index service, and consistency settings.
Example: SELECT name, email FROM `travel-sample` WHERE country = "France"; Another example: SELECT u.name, f.city FROM `users`