Reader small image

You're reading from  Learning Couchbase

Product typeBook
Published inNov 2015
Publisher
ISBN-139781785288593
Edition1st Edition
Right arrow
Author (1)
Henry Potsangbam
Henry Potsangbam
author image
Henry Potsangbam

Henry Potsangbam is an experienced software developer, administrator, and architect with more than 14 years of experience in enterprise application architecture, design, and development. He's worked in various domains, such as e-commerce, retail, and energy sectors. He is an IBM certified application and solution developer, SAP Certified Netweaver EP Consultant and CIPM (project management). Always fascinated by and interested in exploring emerging technologies to solve business scenarios, Henry has been following NoSQL and Couchbase since its initial release around 2011. In his spare time, he explores, and educates professionals in big data technologies such as Hadoop (Mapr, Hortonworks, and Cloudera), enterprise integration (camel, fuse esb, and Mule), analytics with R, messaging with kafka, rabbitMQ, the OSGI framework, NoSQL (Couchbase, Cassandra, and Mongodb), enterprise architecture, and so on. During his career, he architect private cloud implementation using virtualization for one of the fortune 500 company. He also played active role in provisioning infrastructure for one of the largest cash transfer programme in the world.
Read more about Henry Potsangbam

Right arrow

Understanding N1QL syntax


Most N1QL queries will be in the following format:

SELECT [DISTINCT] <expression>
FROM <data source>
WHERE <expression>
GROUP BY <expression>
ORDER BY <expression>
LIMIT <number>
OFFSET <number>

The preceding statement is very generic. It tells you the comprehensive options provided by N1QL in one statement. Let me break it down into parts so that it can be understood easily.

I will be explaining these N1QL query syntax based on documents stored in the bucket, LearningCouchbase, which we created earlier. If you remember correctly, we have already entered some documents in the LearningCouchbase bucket as well. We will execute the N1QL queries only on those documents.

If we want to fetch all the users' documents in the LearningCouchbase bucket, but want to display only some information or attributes, that is, the name and the book attribute of the documents, it can be done as follows:

SELECT name,book
FROM LearningCouchbase...
lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Learning Couchbase
Published in: Nov 2015Publisher: ISBN-13: 9781785288593

Author (1)

author image
Henry Potsangbam

Henry Potsangbam is an experienced software developer, administrator, and architect with more than 14 years of experience in enterprise application architecture, design, and development. He's worked in various domains, such as e-commerce, retail, and energy sectors. He is an IBM certified application and solution developer, SAP Certified Netweaver EP Consultant and CIPM (project management). Always fascinated by and interested in exploring emerging technologies to solve business scenarios, Henry has been following NoSQL and Couchbase since its initial release around 2011. In his spare time, he explores, and educates professionals in big data technologies such as Hadoop (Mapr, Hortonworks, and Cloudera), enterprise integration (camel, fuse esb, and Mule), analytics with R, messaging with kafka, rabbitMQ, the OSGI framework, NoSQL (Couchbase, Cassandra, and Mongodb), enterprise architecture, and so on. During his career, he architect private cloud implementation using virtualization for one of the fortune 500 company. He also played active role in provisioning infrastructure for one of the largest cash transfer programme in the world.
Read more about Henry Potsangbam