OrientDB-SQL-CRUD
查詢
針對某些rid查詢
select from [#13:0,#14:0]
使用count
函數
select count(*) from Person
搭配過濾條件
select from Model where name like "C%"
排序
select distinct(firstName) as name from Person order by name asc
eval表達式運算
select eval("highwayMPG - cityMPG") as variance from Model
使用Match語法
Match {class: Person, as: Person} RETURN $elements
新增
新增多筆紀錄
insert into Model (name, cityMPG, highwayMPG, modelYear) values ("car1", 10, 20, 2013),("car2", 11, 21, 2014)
新增記錄藉由json
insert into Person content {"firstName": "A", "lastName": "B", "info": {"hair": "black", "eyes": "blue"}}
藉由建立vertex方式
create vertex Person content{firstName: "wang", lastName: "pine"}
更新
upsert: 當查詢條件存在時則更新,否則新增
update Person set firstName = "Alberto" upsert where first="wrongname"
update and return
update #13:6890 set firstName="Alberto2" return after