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.

Posted by Keshav Murthy

Keshav Murthy is a Senior Director at Couchbase R&D. Previously, he was Senior Director of Product Management at MapR, Senior Architect for IBM, with more than 20 years experience in database design & development. He lead the SQL and NoSQL query processing team IBM Informix database. He received a President’s Club award at Couchbase, two Outstanding Technical Achievement Awards at IBM. Keshav has a bachelors degree in Computer Science and Engineering from the University of Mysore, India and holds eight US patents.

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! 😀

    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