N1QL is SQL for JSON. The goal of N1QL is to give developers and enterprises an expressive, powerful, and complete language for querying, transforming, and manipulating JSON data.

The goal of N1QL is to give developers and enterprises an expressive, powerful, and complete language for querying, transforming, and manipulating JSON data. Hence, N1QL supports full set of SELECT, INSERT, UPDATE, DELETE, MERGE statements along with a rich set of expressions and operators.

N1QL is inspired from SQL. If you know SQL, you’ll learn N1QL quickly. But, having SQL on the flexible structure of JSON require a  bit of learning.  To make your learning even faster, we have an interactive tutorial.

http://query-tutorial.couchbase.com/tutorial/

The major sections are:

  • Section 1. N1QL basics
  • Section 2. Joins
  • Case Study I. E-Commerce
  • Case Study II. Social Game

You can modify the queries and see how the result changes.  Do the EXPLAIN to see the Query plan.  Have fun learning N1QL.

Here’s a sample screen.

Author

Posted by Keshav Murthy

Keshav Murthy is a Vice President at Couchbase R&D. Previously, he was at MapR, IBM, Informix, Sybase, with more than 20 years of experience in database design & development. He lead the SQL and NoSQL R&D team at IBM Informix. He has received two President's Club awards at Couchbase, two Outstanding Technical Achievement Awards at IBM. Keshav has a bachelor's degree in Computer Science and Engineering from the University of Mysore, India, holds ten US patents and has three US patents pending.

2 Comments

  1. Awesome job, team – love it! Of course, I tried running a DELETE statement right away. It was great to see that the access from this tutorial is read-only! :-D

    1. Yes. Once you learn SELECT, you pretty know the language well.
      You can EXPLAIN your DELETE statements to see how the query executes. If you’re into query plans, checkout the visual explains with profiling in Couchbase 5.0.

Leave a reply