Neptune Query Language

NQL(Neptune Query Language) is simple query language. You can run query with neptune shell or neptune jdbc driver.

create table

CREATE TABLE <table_name> <col1 [, col2, ...]> [VERSION = <number of version>] [comment = <comment>]
  • example: CREATE TABLE t_test (col1, col2) version=3 comment='this is test table'

drop table

DROP TABLE <table_name>
  • example: DROP TABLE t_test

insert

INSERT 
  INTO <table_name> [(column_name1, column_name2, ...)]
VALUES ( ('key1', 'val1')[, ('key1', 'val1'), ...]) 
 WHERE rowkey='row_key'
  • example: INSERT INTO t_test VALUES ( ('c1k1', 'v11') , ('c2k2', 'v12') ) where rowkey = 'rk1'

select

SELECT <*|colum_name1, ...> 
  FROM <table_name>
 WHERE rowkey = '<row_key>'
   AND column_name1 = '<column_key>'
   AND column_name1.timestamp between 'start(yyyyMMddHHmmss)' and 'end(yyyyMMddHHmmss)'
  • select all rows in table: SELECT col1, col2 FROM t_test
  • select a single row: SELECT col1, col2 FROM t_test where rowkey = 'rk1'
  • like: SELECT ol1, col2 FROM t_test where rowkey like 'rk'
  • between: SELECT ol1, col2 FROM t_test where rowkey between 'rk1' and 'and rk100'
  • select with timestamp: SELECT col1 FROM t_test where rowkey = 'rk1' and col1.timestamp between '20070101000000' and '20071231000000'

delete

DELETE * | ( (column_name1 [, column_name2, ...] ) 
  FROM <table_name>
 WHERE rowkey='row_key' [and column_name1 = 'column_key' and ...]
  • example: DELETE col1 FROM t_test WHERE rowkey = 'rk1' and col1 = 'c1k1'