coffee-on-couchbase

You’d like to query JSON document database using SQL-like syntax? Couchbase has N1QL for you.

N1QL is a declarative query language that extends SQL for JSON. You can query data via native framework and language integration, a fluent API, or the JDBC/ODBC drivers.

N1QL enables you to query JSON documents without any limitations – sort, filter, transform, group, and combine data with a single query. That’s right. You can combine data from multiple documents with a JOIN. That flexible data model you were promised? This is it. You’re no longer limited to “single table” and “table per query” data models.

N1QL Tutorial is a great resource to learn the concepts of querying JSON documents using SQL-like syntax. Here are some examples:

OR

OR

OR

OR

So you are ready to experiment with N1QL? You can certainly use CBQ tool. Alternatively you can use Couchbase Query Workbench. The query workbench provides a rich graphical user interface to prepare and execute simple to complex N1QL queries. It provides a convenient way to perform query development by enabling you to browse, create, and run N1QL statements, and view results.

Want to learn how to get started? Learn all about it in this brief session with Eben Haber:

Ask your questions at Stack Overflow or Couchbase Forums.

You can also follow us at @couchbasedev and @couchbase. Enjoy!

Author

Posted by Arun Gupta, VP, Developer Advocacy, Couchbase

Arun Gupta is the vice president of developer advocacy at Couchbase. He has built and led developer communities for 10+ years at Sun, Oracle, and Red Hat. He has deep expertise in leading cross-functional teams to develop and execute strategy, planning and execution of content, marketing campaigns, and programs. Prior to that he led engineering teams at Sun and is a founding member of the Java EE team. Gupta has authored more than 2,000 blog posts on technology. He has extensive speaking experience in more than 40 countries on myriad topics and is a JavaOne Rock Star for three years in a row. Gupta also founded the Devoxx4Kids chapter in the US and continues to promote technology education among children. An author of several books on technology, an avid runner, a globe trotter, a Java Champion, a JUG leader, NetBeans Dream Team member, and a Docker Captain, he is easily accessible at @arungupta.

Leave a reply