OrientDB选择查询而不是连接

时间:2016-02-16 14:25:09

标签: orientdb

我有一个OrientDB文档数据库。我通过Studio执行了以下命令:

DROP CLASS student;
DROP CLASS studyCourse;

CREATE CLASS student;
CREATE CLASS studyCourse;

CREATE PROPERTY student.Id INTEGER;
CREATE INDEX Student.Id UNIQUE;
CREATE PROPERTY student.surname STRING;
CREATE PROPERTY student.FK_studyCourse_abbreviation STRING;

CREATE PROPERTY studyCourse.abbreviation STRING;
CREATE INDEX studyCourse.abbreviation UNIQUE;
CREATE PROPERTY studyCourse.name STRING;

CREATE LINK student TYPE LINKSET FROM student.FK_studyCourse_abbreviation TO studyCourse.abbreviation INVERSE;

INSERT INTO studyCourse SET abbreviation = 'Inf', name = 'informatics';

INSERT INTO student SET Id = '11111', surname = 'Miller';
UPDATE studyCourse ADD student = (SELECT FROM student WHERE Id = '11111') WHERE abbreviation = 'Inf';

现在我想按手册(http://orientdb.com/docs/2.1/SQL.html)中所述选择值:

SELECT * FROM studyCourse WHERE student.surname = 'Miller';

找不到记录。

1 个答案:

答案 0 :(得分:2)

尝试使用 contains 而不是 =

SELECT FROM studyCourse WHERE student.surname contains 'Miller'

这对我有用:

----+-----+-----------+------------+-----------+-------
#   |@RID |@CLASS     |abbreviation|name       |student
----+-----+-----------+------------+-----------+-------
0   |#14:0|studyCourse|Inf         |informatics|[1]    
----+-----+-----------+------------+-----------+-------

伊万