v1.10

Document

How to Start SequoiaDB

Basic Operation

Data Model

Database Management

Aggregation

Index

Replication

Cluster

Connector

Reference

Development

Release Note

FAQ

  • Content
  • Comments
  • History

SQL to SequoiaDB shell to Java

The query in SequoiaDB is in the format of json(bson). The following table shows examples comparing sql statements, SequoiaDB shell statements and SequoiaDB java driver application statements.

SQL SequoiaDB shell Java Driver
insert into students(a,b) values(1,-1) db.foo.bar.insert({a:1,b:-1}) bar.insert("{'a':1,'b':-1}")
select a,b from students db.foo.bar.find(null,{a:"",b:""}) bar.query("", "{'a':'','b':''}", "", "")
select * from students db.foo.bar.find() bar.query()
select * from students where age=20 db.foo.bar.find({age:20}) bar.query("{'age':20}", "", "", "")
select * from students where age=20 order by name db.foo.bar.find({age:20}).sort({name:1}) bar.query("{'age':20}", "", "{'name':1}", "")
select * from students where age>20 and age<30 db.foo.bar.find({age:{$gt:20,$lt:30}}) bar.query("{'age':{'$gt':20,'$lt':30}}", "", "", "")
create index testIndex on students(name) db.foo.bar.createIndex("testIndex",{name:1},false) bar.createIndex("testIndex", "{'name':1}", false, false)
select * from students limit 20 skip 10 db.foo.bar.find().limit(20).skip(10) bar.query("", "", "", "", 10, 20)
select count(*) from students where age>20 db.foo.bar.find({age:{$gt:20}}).count() bar.getCount("{'age':{'$gt':20}}")
update students set a=a+2 where b=-1 db.foo.bar.update({$set:{a:2}},{b:-1}) bar.update("{'b':-1}", "{'$inc':{'a':2}}", "")
delete from students where a=1 db.foo.bar.remove({a:1}) bar.delete("{'a':1}")
please login to comment.
Latest Comment
  • 2015-03-14

About Us

SequoiaDB is a financial-level distributed database vendor and is the first Chinese database listed in Gartner’s Magic Quadrant OPDBMS report. SequoiaDB has recently released version 3.0.
SequoiaDB is now penetrating the vertical sector Financial Industry quickly and had more than 50 banking clients and hundreds of enterprise customers in industries including government, telecommunication, Internet and IoT.

Beijing:
Tower R, No.8 North Star East Road, Chaoyang District, Beijing,China
Guangzhou:
Tower A, No.22 Qinglan Street, Panyu District, Guangzhou,China
Shenzhen:
Tsing Hua Tech Park, Nanshan District, Shenzhen,China
Tel:400-8038-339
E-mail:contact@sequoiadb.com