Basic SQL Joins - N1ql Typing CST Test
Loading…
Basic SQL Joins — N1ql Code
Examples of INNER JOIN and LEFT JOIN queries.
-- Inner Join
SELECT orders.id, users.name
FROM orders
INNER JOIN users ON orders.user_id = users.id;
-- Left Join
SELECT orders.id, users.name
FROM orders
LEFT JOIN users ON orders.user_id = users.id;N1ql Language Guide
N1QL (Non-First Normal Form Query Language) is Couchbase’s SQL-like query language designed for JSON document databases. It enables SQL-style querying, joins, aggregation, indexing, and full-text search on flexible JSON data.
Primary Use Cases
- ▸SQL-style querying on JSON data
- ▸JOIN operations on NoSQL JSON documents
- ▸High-performance analytics
- ▸Full-text search and indexing
- ▸Caching and session management
- ▸Recommendation engines and personalization pipelines
Notable Features
- ▸Full SQL capabilities (SELECT, JOIN, GROUP BY, ORDER BY)
- ▸Powerful secondary indexing
- ▸Supports JSON-based schema flexibility
- ▸User-defined functions and expressions
- ▸Full-text search integration (FTS)
- ▸High-performance distributed execution
Origin & Creator
Developed by Couchbase Inc., introduced publicly in 2015 to provide SQL querying capabilities on JSON in a distributed NoSQL database.
Industrial Note
N1QL excels in environments needing massive read/write throughput with SQL-like querying over JSON-such as ad-tech, gaming, finance, e-commerce personalization, digital catalogs, session stores, caching layers, and multi-model microservices.